@g1cloud/entity-modeler-next 5.0.0-alpha.1 → 5.0.0-alpha.10

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,10 +1,10 @@
1
- (function(Ne,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ne=typeof globalThis<"u"?globalThis:Ne||self,n(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,n,te){"use strict";var Fx=Object.defineProperty;var Gx=(Ne,n,te)=>n in Ne?Fx(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[n]=te;var Le=(Ne,n,te)=>Gx(Ne,typeof n!="symbol"?n+"":n,te);const Qd={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function eu(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function _a(e,t,o={}){const i={...Qd,...o},l=new Map(e.entities.map(h=>[h.modelId,h])),a=new Map(e.associations.map(h=>[h.modelId,h])),r=new Map(t.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(t.associationLayouts.map(h=>[h.associationRef,h])),c=t.entityLayouts.map(h=>h.entityRef).filter(h=>!l.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!a.has(h)),u=new Map;for(const h of e.groups)for(const S of h.memberEntityRefs)u.set(S,h.modelId);const f=new Map;for(const h of t.groupLayouts)for(const S of h.memberNoteRefs??[])f.set(S,h.groupRef);let p=0;const m=e.entities.map(h=>{const S=u.get(h.modelId),X=r.get(h.modelId);if(X){const J={location:{x:X.geo.location.x,y:X.geo.location.y},size:{width:X.geo.size.width,height:X.geo.size.height}};return{entity:h,geo:J,collapsed:X.collapsed??!1,groupRef:S,style:X.style,attributeStyles:X.attributeStyles,operationStyles:X.operationStyles}}const W=eu(p++,i);return{entity:h,geo:W,collapsed:!1,groupRef:S}}),g=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),_=e.groups.map(h=>{const S=g.get(h.modelId),X=S?{location:{x:S.geo.location.x,y:S.geo.location.y},size:{width:S.geo.size.width,height:S.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:X,style:S==null?void 0:S.style}}),k=e.associations.map(h=>{const S=s.get(h.modelId);return{association:h,waypoints:(S==null?void 0:S.waypoints)??[],sourceColumnRef:S==null?void 0:S.sourceColumnRef,targetColumnRef:S==null?void 0:S.targetColumnRef}}),b=t.notes.map(h=>({note:{...h,geo:{location:{x:h.geo.location.x,y:h.geo.location.y},size:{width:h.geo.size.width,height:h.geo.size.height}}},groupRef:f.get(h.modelId)})),$=[];for(const h of t.notes)for(const S of h.connections??[])l.has(S.targetRef)&&$.push({noteRef:h.modelId,targetRef:S.targetRef,waypoints:S.waypoints.map(X=>({x:X.x,y:X.y}))});return{entities:m,associations:k,groups:_,notes:b,noteConnections:$,prunedEntityRefs:c,prunedAssociationRefs:d}}function kn(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 ln=.5;function va(e,t,o,i,l,a){const r=kn(t),s=kn(l),c={x:e.x+r.x*a,y:e.y+r.y*a},d={x:i.x+s.x*a,y:i.y+s.y*a},u=[c,...o,d],f=[];let p=e;const m=(k,b)=>{(Math.abs(k.x-p.x)>=ln||Math.abs(k.y-p.y)>=ln)&&(f.push({a:p,b:k,seg:b}),p=k)};m(c,0);let g=r.x!==0,_=c;for(let k=1;k<u.length;k++){const b=u[k],$=k<=o.length?k-1:o.length,h=Math.abs(b.x-_.x)<ln,S=Math.abs(b.y-_.y)<ln;h&&S||(h?(m(b,$),g=!1):S?(m(b,$),g=!0):g?(m({x:_.x,y:b.y},$),m(b,$),g=!0):(m({x:b.x,y:_.y},$),m(b,$),g=!1),_=b)}return m(i,o.length),f}function Bi(e,t,o,i,l,a=20){const r=va(e,t,o,i,l,a);let s=`M ${Ge(e.x)},${Ge(e.y)}`;for(const c of r)s+=` L ${Ge(c.b.x)},${Ge(c.b.y)}`;return s}const tu=14;function Di(e,t,o,i,l,a=20){return va(e,t,o,i,l,a).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=tu).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function Ge(e){return Math.round(e*100)/100}const nu=36;function wa(e,t,o=nu){const i=Math.max(e.x,t.x)+o;return`M ${Ge(e.x)},${Ge(e.y)} L ${Ge(i)},${Ge(e.y)} L ${Ge(i)},${Ge(t.y)} L ${Ge(t.x)},${Ge(t.y)}`}function Oi(e,t,o){const i=[e,...t,o];let l=`M ${Ge(i[0].x)},${Ge(i[0].y)}`;for(let a=1;a<i.length;a++)l+=` L ${Ge(i[a].x)},${Ge(i[a].y)}`;return l}function ou(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Li(e,t){const o=ou(e),i=e.width/2,l=e.height/2,a=t.x-o.x,r=t.y-o.y;if(Math.abs(a)<ln&&Math.abs(r)<ln)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=a!==0?i/Math.abs(a):1/0,c=r!==0?l/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+a*d,y:o.y+r*d},f=s<=c?a>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function Pi(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function zi(e,t,o){const i=[e,...t,o],l=[];for(let a=1;a<i.length;a++){const r=i[a-1],s=i[a];l.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return l}const iu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ea(e,t,o={}){const i={...iu,...o},l=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),a=[];let r=0;for(const u of e.groups){const f=l.get(u.modelId),p=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const g=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,k)=>{const b=k%g,$=Math.floor(k/g);a.push({id:_,location:{x:p.x+i.pad+b*i.cellWidth,y:p.y+i.pad+i.headerHeight+$*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const p=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);a.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+m*i.cellHeight}})}),a}function go(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function Na(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 ka(e){var a,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((a=c.name)==null?void 0:a.ko)??c.modelId));const l=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);l.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,g)=>m.order-g.order);for(const m of f){if(m.attrType==="DIVIDER"){l.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const g=m.dbAttrs[0],_=g!=null&&g.length?`(${g.length}${g.scale!=null?`,${g.scale}`:""})`:"",k=g?` → ${g.physicalName} ${g.dataType}${_}`:"",b=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",g!=null&&g.unique?"UNIQUE":"",g!=null&&g.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);l.push(` - ${m.name}: ${m.type}${k}${b.length?` {${b.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const g=m.columns.map(_=>`${o.get(_.columnRef)??_.columnRef}${_.descending?" DESC":""}`).join(", ");l.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${g}`)}const p=[...c.operations??[]].sort((m,g)=>m.order-g.order);for(const m of p){const g=m.visibility?` {${m.visibility}}`:"",_=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";l.push(` method ${m.name}()${g}${_}`)}l.push("")}if(e.associations.length){l.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,f=c.end2.composition||c.end1.composition?" (composition)":"";l.push(` ${d} ${Na(c.end1.multiplicity)} —— ${Na(c.end2.multiplicity)} ${u}${f}`)}}return l.join(`
2
- `).trim()}function Ke(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function xe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function xa(e){return`<text ${[`x="${xe(e.x)}"`,`y="${xe(e.y)}"`,`fill="${Ke(e.fill)}"`,`font-size="${xe(e.fontSize)}"`,e.fontFamily?`font-family="${Ke(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ke(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ke(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ke(e.text)}</text>`}function lu(e){return`<line x1="${xe(e.x1)}" y1="${xe(e.y)}" x2="${xe(e.x2)}" y2="${xe(e.y)}" stroke="${Ke(e.stroke)}" stroke-width="${xe(e.strokeWidth??1)}" />`}function au(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 ru(e,t,o,i,l){return[`M${xe(e+l.tl)},${xe(t)}`,`L${xe(e+o-l.tr)},${xe(t)}`,l.tr?`Q${xe(e+o)},${xe(t)} ${xe(e+o)},${xe(t+l.tr)}`:"",`L${xe(e+o)},${xe(t+i-l.br)}`,l.br?`Q${xe(e+o)},${xe(t+i)} ${xe(e+o-l.br)},${xe(t+i)}`:"",`L${xe(e+l.bl)},${xe(t+i)}`,l.bl?`Q${xe(e)},${xe(t+i)} ${xe(e)},${xe(t+i-l.bl)}`:"",`L${xe(e)},${xe(t+l.tl)}`,l.tl?`Q${xe(e)},${xe(t)} ${xe(e+l.tl)},${xe(t)}`:"","Z"].filter(Boolean).join(" ")}function Ui(e){const t=au(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${Ke(e.fill)}"`,`stroke="${Ke(e.stroke)}"`,`stroke-width="${xe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ke(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${xe(e.opacity)}"`:""].filter(Boolean),a=[o?`<path d="${ru(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${xe(e.x)}" y="${xe(e.y)}" width="${xe(e.w)}" height="${xe(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])a.push(lu(r));for(const r of e.texts)a.push(xa(r));for(const r of e.icons??[])a.push(r);return`<g>${a.join("")}</g>`}function su(e){const o=[`<path ${[`d="${Ke(e.d)}"`,'fill="none"',`stroke="${Ke(e.stroke)}"`,`stroke-width="${xe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ke(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(xa(i));return`<g>${o.join("")}</g>`}function $a(e){const{x:t,y:o,w:i,h:l}=e.viewBox,a=[];e.background&&a.push(`<rect x="${xe(t)}" y="${xe(o)}" width="${xe(i)}" height="${xe(l)}" fill="${Ke(e.background)}" />`);for(const r of e.groups)a.push(Ui(r));for(const r of e.edges)a.push(su(r));for(const r of e.entities)a.push(Ui(r));for(const r of e.notes)a.push(Ui(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${xe(t)} ${xe(o)} ${xe(i)} ${xe(l)}" width="${xe(i)}" height="${xe(l)}">`+a.join("")+"</svg>"}const cu=["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"],du=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"]),uu=cu.filter(e=>!du.has(e)),fu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Hi(e){return fu[e]??e}const mu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]);function Ia(e,t=uu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Pt="CustomType",yo="GroupCodeEnum",Sa="String",Ca=[{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:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{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:yo,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Pt,label:"CustomType"}],pu=new Map(Ca.map(e=>[e.value,e.label]));function xn(e){return pu.get(e)??e}const hu=new Set([yo,"CustomMoneyType"]),gu=Ca.filter(e=>!hu.has(e.value)).map(e=>e.value===Pt?{...e,label:"CustomType (사용자정의)"}:e);function Ra(e,t=[]){const o=t.map(l=>{var r,s;const a=((r=l.label)==null?void 0:r.ko)??((s=l.label)==null?void 0:s.en);return{value:l.type,label:a?`${l.type} (${a})`:l.type}}),i=[...gu,...o];return e&&!i.some(l=>l.value===e)?[{value:e,label:xn(e)},...i]:i}function yu(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Va(e,t){var l;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(a=>a.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((l=i.jpa)==null?void 0:l.collectionType)??"LIST"}function Fi(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${xn(t.type)}>`:yu(t)?xn(t.type):e==="CLASS"?t.type===Pt&&t.customType||xn(t.type):Hi(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function $n(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function bo(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const Gi=63;function _o(e){if(!e)return null;const t=e.length;return t<=Gi?null:`물리명이 ${Gi}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Aa(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function it(e){return!e||e.trim()===""}function In(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function bu(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,l=2,a=new Map,r=[],s=[],c=new Set,d=u=>{a.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=a.get(f)??o;if(p===o)d(f);else if(p===i){const m=r.slice(r.indexOf(f)),g=[...m].sort().join(" ");c.has(g)||(c.add(g),s.push(m))}}r.pop(),a.set(u,l)};for(const u of e.entities)(a.get(u.modelId)??o)===o&&d(u.modelId);return s}function Yi(e,t){const o=new Map;for(const i of e){const l=t(i);l==null||l===""||o.set(l,(o.get(l)??0)+1)}return e.filter(i=>{const l=t(i);return l!=null&&l!==""&&(o.get(l)??0)>1})}function Ta(e,t){var a,r,s;const o=[];for(const c of Yi(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(m=>m.attrType!=="DIVIDER");if(it(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(m=>m.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),it((a=c.table)==null?void 0:a.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const m of d.filter(g=>g.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${m.name}"`});for(const m of d.filter(g=>g.identifier&&g.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${m.name}"`});for(const m of d)if(!m.identifier)for(const g of m.dbAttrs)!g.autoIncrement&&it(g.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`채번(${g.autoIncrement?"auto increment":`시퀀스 "${g.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${m.name}"에 설정되어 있습니다`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const m of Yi(d,g=>g.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${m.name}"`});for(const m of d)it(m.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(m=>m.dbAttrs).filter(m=>m.sharedColumnRef==null);for(const m of Yi(u,g=>g.physicalName))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${m.physicalName}"`});for(const m of u){const g=_o(m.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!it(m.physicalName)&&t.reservedWords.has(m.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${m.physicalName}"`}),t!=null&&t.selectableDataTypes&&!it(m.dataType)&&!t.selectableDataTypes.has(m.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${m.dataType}"`}),!it(m.dataType)&&mu.has(m.dataType)&&!m.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`${m.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const m=$n(d.flatMap(g=>g.dbAttrs));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const _=t.embeddableCatalog.find(k=>k.type===g.type);_&&g.dbAttrs.forEach((k,b)=>{if(k.sharedColumnRef==null)return;const $=_.fields[b],h=m.get(k.sharedColumnRef);if(!$||!h)return;(h.dataType!==$.dataType||(h.length??null)!==($.length??null)||(h.scale??null)!==($.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${Aa(h)})이 ${$.name??"컬럼"} 정의(${Aa($)})와 다릅니다`})})}}for(const m of d){const g=m.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;m.type===yo&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${m.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const f=(s=c.table)==null?void 0:s.physicalName,p=_o(f);p&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:p}),t!=null&&t.reservedWords&&!it(f)&&t.reservedWords.has(f.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${f}"`});for(const m of c.indexes??[]){const g=_o(m.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!it(m.name)&&t.reservedWords.has(m.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${m.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){In(c.end1.multiplicity)&&In(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],p=f.includes("ALL"),m=f.includes("REMOVE");p&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||p)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${p?"ALL":"REMOVE"}와 의미가 겹칩니다`}),In(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&In(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!In(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const l=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of bu(e)){const d=[...c,c[0]].map(u=>l.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!it(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Se(){return crypto.randomUUID()}class Wi{constructor(t){Le(this,"undoStack",[]);Le(this,"redoStack",[]);Le(this,"savePoint",null);Le(this,"listeners",new Set);Le(this,"commandListeners",new Set);Le(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const l of this.commandListeners)l(t,o,i)}}function Ma(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Fe(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function je(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Me(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function gt(e,t,o){var i,l;return(l=(i=e.layout.notes.find(a=>a.modelId===t))==null?void 0:i.connections)==null?void 0:l.find(a=>a.targetRef===o)}function Ki(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=Ma(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const l=Fe(o,e.modelId);l>=0&&o.layout.entityLayouts.splice(l,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Xi(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const l=Ma(i,e);if(l<0)throw new Error(`엔티티 없음: ${e}`);const a=Fe(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[l],index:l},entityLayout:a>=0?{item:i.layout.entityLayouts[a],index:a}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(p=>p.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}a>=0&&i.layout.entityLayouts.splice(a,1),i.logical.entities.splice(l,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((l,a)=>l.index-a.index).forEach(l=>i.logical.associations.splice(l.index,0,l.item)),[...t.assocLayouts].sort((l,a)=>l.index-a.index).forEach(l=>i.layout.associationLayouts.splice(l.index,0,l.item));for(const l of t.groupMemberships){const a=i.logical.groups.find(r=>r.modelId===l.groupId);a==null||a.memberEntityRefs.splice(l.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],l=[];for(const a of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:a.item.modelId}),l.push({kind:"association.add",casUnit:"logical",associationRef:a.item.modelId,value:a.item});for(const a of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:a.item.associationRef,incidental:!0}),l.push({kind:"associationLayout.add",casUnit:"layout",associationRef:a.item.associationRef,value:a.item,incidental:!0});for(const a of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e}),l.push({kind:"group.addMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),l.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),l.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:l.reverse()}}}}function Ba(e,t){const o={};return{label:"엔티티 수정",apply(i){const l=Me(i,e);for(const a of Object.keys(t))o[a]=l[a];Object.assign(l,t)},invert(i){Object.assign(Me(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Da(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const l=Me(i,e);o=l.name,l.name=t},invert(i){Me(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function an(e,t){let o=null;return{label:"엔티티 이동",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.location},a.location={...t}},invert(i){const l=Fe(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.location=o)},emitOps(){const i=l=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Oa(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.size},a.size={...t}},invert(i){const l=Fe(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.size=o)},emitOps(){const i=l=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function qi(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function La(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.style,a.style=qi(a.style,t)},invert(i){const l=Fe(i,e);l>=0&&(i.layout.entityLayouts[l].style=o)},emitOps(i){const l=Fe(i,e),a=l>=0?i.layout.entityLayouts[l].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(a)],invert:[r(o)]}}}}function Pa(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.collapsed,a.collapsed=t},invert(i){const l=Fe(i,e);l>=0&&(i.layout.entityLayouts[l].collapsed=o)},emitOps(){const i=l=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:l}});return{forward:[i(t)],invert:[i(o)]}}}}function Zi(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,l)=>{i.collapsed=t[l]})},emitOps(o){const i=[],l=[];return o.layout.entityLayouts.forEach((a,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:e}}),l.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:l}}}}function vo(e,t,o){let i;return{label:"속성 색상 변경",apply(l){const a=Fe(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.attributeStyles;const s={...r.attributeStyles},c=qi(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(l){const a=Fe(l,e);a>=0&&(l.layout.entityLayouts[a].attributeStyles=i)},emitOps(l){const a=Fe(l,e),r=a>=0?l.layout.entityLayouts[a].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function ji(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e.modelId);l>=0&&o.layout.groupLayouts.splice(l,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function za(e,t){const o={},i=l=>{const a=l.logical.groups.find(r=>r.modelId===e);if(!a)throw new Error(`그룹 없음: ${e}`);return a};return{label:"그룹 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ji(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:l>=0?{item:o.layout.groupLayouts[l],index:l}:void 0},l>=0&&o.layout.groupLayouts.splice(l,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Ua(e,t){let o=!1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에 편입",apply(l){const a=i(l);a&&!a.memberEntityRefs.includes(t)&&(a.memberEntityRefs.push(t),o=!0)},invert(l){if(!o)return;const a=i(l),r=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1;r>=0&&a.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function wo(e,t){let o=-1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에서 제외",apply(l){const a=i(l);o=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1,o>=0&&a.memberEntityRefs.splice(o,1)},invert(l){var a;o<0||(a=i(l))==null||a.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ha(e,t){let o=null;return{label:"그룹 이동",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Fa(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function yt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Me(o,e).attributes.push(t)},invert(o){const i=Me(o,e),l=i.attributes.findIndex(a=>a.modelId===t.modelId);l>=0&&i.attributes.splice(l,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function zt(e,t,o){const i={},l=a=>{const r=Me(a,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function It(e,t){let o=null;return{label:"속성 삭제",apply(i){const l=Me(i,e),a=l.attributes.findIndex(r=>r.modelId===t);if(a<0)throw new Error(`속성 없음: ${t}`);o={item:l.attributes[a],index:a},l.attributes.splice(a,1)},invert(i){o&&Me(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Qi(e,t,o){let i=null;return{label:"속성 재정렬",apply(l){const a=Me(l,e);i=a.attributes.map(f=>({...f}));const r=new Set(t),s=a.attributes.filter(f=>r.has(f.modelId)),c=a.attributes.filter(f=>!r.has(f.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];a.attributes.splice(0,a.attributes.length,...u),a.attributes.forEach((f,p)=>f.order=p)},invert(l){i&&Me(l,e).attributes.splice(0,1/0,...i)},emitOps(l){const a=Me(l,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Ga(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const l=Me(i,e);l.operations||(l.operations=[],o=!0),l.operations.push(t)},invert(i){var r;const l=Me(i,e),a=((r=l.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;a>=0&&l.operations.splice(a,1),o&&l.operations&&l.operations.length===0&&(l.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Ya(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Wa(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const l=Me(i,e),a=((s=l.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(a<0)throw new Error(`메서드 없음: ${t}`);const r=l.operations.length===1;o={item:l.operations[a],index:a,wasSole:r},l.operations.splice(a,1),r&&(l.operations=void 0)},invert(i){if(!o)return;const l=Me(i,e);l.operations||(l.operations=[]),l.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Ka(e,t,o){let i=null;return{label:"메서드 재정렬",apply(l){const a=Me(l,e),r=a.operations??[];i=r.map(p=>({...p}));const s=new Set(t),c=r.filter(p=>s.has(p.modelId)),d=r.filter(p=>!s.has(p.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((p,m)=>p.order=m),a.operations=r},invert(l){if(!i)return;const a=Me(l,e);a.operations&&a.operations.splice(0,1/0,...i)},emitOps(l){const a=(Me(l,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Xa(e,t,o){let i;return{label:"메서드 색상 변경",apply(l){const a=Fe(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.operationStyles;const s={...r.operationStyles},c=qi(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(l){const a=Fe(l,e);a>=0&&(l.layout.entityLayouts[a].operationStyles=i)},emitOps(l){const a=Fe(l,e),r=a>=0?l.layout.entityLayouts[a].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function el(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e.modelId);l>=0&&o.layout.associationLayouts.splice(l,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function tl(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:l>=0?{item:o.layout.associationLayouts[l],index:l}:void 0},l>=0&&o.layout.associationLayouts.splice(l,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Eo(e,t){const o={},i=l=>{const a=l.logical.associations.find(r=>r.modelId===e);if(!a)throw new Error(`관계 없음: ${e}`);return a};return{label:"관계 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function rn(e,t,o){const i={},l=a=>{const r=a.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function qa(e,t){return{label:"인덱스 추가",apply(o){const i=Me(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var a;const i=Me(o,e),l=((a=i.indexes)==null?void 0:a.findIndex(r=>r.modelId===t.modelId))??-1;l>=0&&i.indexes.splice(l,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Za(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function ja(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const l=Me(i,e),a=((r=l.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(a<0)throw new Error(`인덱스 없음: ${t}`);o={item:l.indexes[a],index:a},l.indexes.splice(a,1)},invert(i){o&&Me(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const lt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Sn=(e,t)=>{var o;return((o=je(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Ja(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(l){const a=je(l,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...a.waypoints[t]},a.waypoints.splice(t,1,{...o})},invert(l){const a=je(l,e);a&&i&&a.waypoints.splice(t,1,i)},emitOps(l){const a=Sn(l,e),r=a.map((s,c)=>c===t&&i?{...i}:s);return{forward:[lt(e,a)],invert:[lt(e,r)]}}}}function Qa(e,t){let o=null;return{label:"waypoint 제거",apply(i){const l=je(i,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...l.waypoints[t]},l.waypoints.splice(t,1)},invert(i){const l=je(i,e);l&&o&&l.waypoints.splice(t,0,o)},emitOps(i){const l=Sn(i,e),a=l.slice();return o&&a.splice(t,0,{...o}),{forward:[lt(e,l)],invert:[lt(e,a)]}}}}function er(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(l){const a=je(l,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);i=a.waypoints.map(r=>({...r})),a.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(l){const a=je(l,e);a&&i&&(a.waypoints=i)},emitOps(l){return{forward:[lt(e,Sn(l,e))],invert:[lt(e,i??[])]}}}}function tr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=je(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(l=>({...l})),i.waypoints=[]},invert(o){const i=je(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[lt(e,Sn(o,e))],invert:[lt(e,t??[])]}}}}function nr(e,t,o){return{label:"waypoint 추가",apply(i){const l=je(i,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);l.waypoints.splice(t,0,{...o})},invert(i){const l=je(i,e);l==null||l.waypoints.splice(t,1)},emitOps(i){const l=Sn(i,e),a=l.slice();return a.splice(t,1),{forward:[lt(e,l)],invert:[lt(e,a)]}}}}function or(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function nl(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Cn(e,t){let o=null;return{label:"노트 이동",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function ir(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function lr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o=l.memo,l.memo=t},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&(l.memo=o)},emitOps(){const i=l=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:l}});return{forward:[i(t)],invert:[i(o)]}}}}function ar(e,t){let o=!1,i=!1;const l=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(a){const r=l(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(a){if(!o)return;const r=l(a);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function rr(e,t){let o=-1;const i=l=>l.layout.groupLayouts.find(a=>a.groupRef===e);return{label:"그룹에서 노트 제외",apply(l){var r;const a=i(l);o=((r=a==null?void 0:a.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&a.memberNoteRefs.splice(o,1)},invert(l){if(o<0)return;const a=i(l);a&&(a.memberNoteRefs||(a.memberNoteRefs=[]),a.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const St=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),No=(e,t,o)=>{var i;return((i=gt(e,t,o))==null?void 0:i.waypoints.map(l=>({...l})))??[]};function sr(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(l){const a=l.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);if(a.connections||(a.connections=[],i=!0),a.connections.some(r=>r.targetRef===t)){o=!1;return}a.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(l){if(!o)return;const a=l.layout.notes.find(s=>s.modelId===e);if(!(a!=null&&a.connections))return;const r=a.connections.findIndex(s=>s.targetRef===t);r>=0&&a.connections.splice(r,1),i&&delete a.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function cr(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const l=i.layout.notes.find(s=>s.modelId===e),a=((r=l==null?void 0:l.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(l!=null&&l.connections)||a<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:l.connections[a],index:a},l.connections.splice(a,1)},invert(i){if(!o)return;const l=i.layout.notes.find(a=>a.modelId===e);l!=null&&l.connections&&l.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function dr(e,t,o,i){let l=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(a){const r=gt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);l={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(a){const r=gt(a,e,t);r&&l&&r.waypoints.splice(o,1,l)},emitOps(a){const r=No(a,e,t),s=r.map((c,d)=>d===o&&l?{...l}:c);return{forward:[St(e,t,r)],invert:[St(e,t,s)]}}}}function ur(e,t,o,i){return{label:"waypoint 추가",apply(l){const a=gt(l,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);a.waypoints.splice(o,0,{...i})},invert(l){const a=gt(l,e,t);a==null||a.waypoints.splice(o,1)},emitOps(l){const a=No(l,e,t),r=a.slice();return r.splice(o,1),{forward:[St(e,t,a)],invert:[St(e,t,r)]}}}}function fr(e,t,o){let i=null;return{label:"waypoint 제거",apply(l){const a=gt(l,e,t);if(!a||!a.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...a.waypoints[o]},a.waypoints.splice(o,1)},invert(l){const a=gt(l,e,t);a&&i&&a.waypoints.splice(o,0,i)},emitOps(l){const a=No(l,e,t),r=a.slice();return i&&r.splice(o,0,{...i}),{forward:[St(e,t,a)],invert:[St(e,t,r)]}}}}function mr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const l=gt(i,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);o=l.waypoints.map(a=>({...a})),l.waypoints=[]},invert(i){const l=gt(i,e,t);l&&o&&(l.waypoints=o)},emitOps(i){return{forward:[St(e,t,No(i,e,t))],invert:[St(e,t,o??[])]}}}}function Be(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const l of t)l.apply(i)},invert(i){for(let l=t.length-1;l>=0;l--)t[l].invert(i)},emitOps(i){const l=t.map(a=>{if(!a.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${a.label}`);return a.emitOps(i)});return{forward:l.flatMap(a=>a.forward),invert:l.slice().reverse().flatMap(a=>a.invert)}}}}const _u=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:el,addAttribute:yt,addEntity:Ki,addEntityToGroup:Ua,addGroup:ji,addIndex:qa,addNote:or,addNoteConnection:sr,addNoteConnectionWaypoint:ur,addNoteToGroup:ar,addOperation:Ga,addWaypoint:nr,clearNoteConnectionWaypoints:mr,clearWaypoints:tr,composite:Be,moveEntity:an,moveGroup:Ha,moveNote:Cn,moveNoteConnectionWaypoint:dr,moveWaypoint:Ja,removeAssociation:tl,removeAttribute:It,removeEntity:Xi,removeEntityFromGroup:wo,removeGroup:Ji,removeIndex:ja,removeNote:nl,removeNoteConnection:cr,removeNoteConnectionWaypoint:fr,removeNoteFromGroup:rr,removeOperation:Wa,removeWaypoint:Qa,renameEntity:Da,reorderAttributes:Qi,reorderOperations:Ka,resizeEntity:Oa,resizeGroup:Fa,resizeNote:ir,setAllEntitiesCollapsed:Zi,setAttributeSwatch:vo,setEntityCollapsed:Pa,setEntitySwatch:La,setNoteMemo:lr,setOperationSwatch:Xa,translateWaypoints:er,updateAssociation:Eo,updateAssociationEnd:rn,updateAttribute:zt,updateEntity:Ba,updateGroup:za,updateIndex:Za,updateOperation:Ya},Symbol.toStringTag,{value:"Module"}));class pr{constructor(){Le(this,"revs",new Map);Le(this,"layoutVersion",0);Le(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class hr{constructor(t){Le(this,"cache",new pr);Le(this,"newClientOpId");Le(this,"debounceMs");Le(this,"emissions",new WeakMap);Le(this,"open",null);Le(this,"debounceHandle",null);Le(this,"queue",[]);Le(this,"sending",!1);Le(this,"_frozen",!1);Le(this,"stack",null);Le(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Se,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,l,a)=>this.handle(i,l,a));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let l;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);l=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);l=s}const a=o==="undo"?l.invert:l.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=a,this.emissions.set(t,{forward:a,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,l),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:a,inv:l.invert},this.startDebounce();return}a.length&&this.enqueue(this.buildBatch(a))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let l=!1,a=!1;for(const r of t)if(r.casUnit==="logical")if(l=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(a=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return a&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),l&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,l;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(a){this.sending=!1,(l=(i=this.opts).onError)==null||l.call(i,a),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const gr=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update"];function vu(e,t){const o=()=>e.entities.filter(a=>{var r;return((r=a.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(a=>a.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const l=o();return l.length?l:i()}function wu(e,t){const o=()=>e.attributes.filter(a=>a.name===t.ref),i=()=>e.attributes.filter(a=>a.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const l=o();return l.length?l:i()}function yr(e,t,o){return e.associations.filter(i=>{const l=[i.end1.entityRef,i.end2.entityRef];return l.includes(t)&&l.includes(o)})}function at(e,t){const o=vu(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Eu(e,t){const o=wu(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Nu(e,t,o={}){const i=o.mkId??Se,l=[],a=[];return t.forEach((r,s)=>{switch(r.kind){case"entity.add":{const c=i(),d={modelId:c,name:r.spec.name,stereotype:r.spec.stereotype??"JPA_ENTITY",attributes:[],...r.spec.physicalName?{table:{physicalName:r.spec.physicalName}}:{}};l.push({kind:"entity.add",casUnit:"logical",entityRef:c,value:d});break}case"entity.update":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,patch:r.patch});break}case"entity.remove":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:c.value.modelId});break}case"attribute.add":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}const d=i(),u=r.spec.physicalName!=null||r.spec.dataType!=null||r.spec.length!=null||r.spec.scale!=null,f={modelId:d,name:r.spec.name,type:r.spec.type,attrType:"NORMAL",identifier:r.spec.identifier??!1,notNull:r.spec.notNull??!1,order:c.value.attributes.length,dbAttrs:u?[{modelId:i(),physicalName:r.spec.physicalName??r.spec.name,dataType:r.spec.dataType??"",...r.spec.length?{length:r.spec.length}:{},...r.spec.scale?{scale:r.spec.scale}:{}}]:[]};l.push({kind:"attribute.add",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,value:f});break}case"attribute.update":case"attribute.remove":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}const d=Eu(c.value,r.attribute);if(!d.ok){a.push(d.reason==="not-found"?{code:"attribute-not-found",opIndex:s,entity:r.entity,handle:r.attribute}:{code:"attribute-ambiguous",opIndex:s,entity:r.entity,handle:r.attribute,matches:d.matches});break}r.kind==="attribute.update"?l.push({kind:"attribute.update",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,attributeRef:d.value.modelId,patch:r.patch}):l.push({kind:"attribute.remove",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,attributeRef:d.value.modelId});break}case"association.add":{const c=at(e,r.spec.from),d=at(e,r.spec.to);if(c.ok||a.push(rt(c.reason,s,r.spec.from,c.matches)),d.ok||a.push(rt(d.reason,s,r.spec.to,d.matches)),!c.ok||!d.ok)break;if(r.spec.identifying&&c.value.modelId===d.value.modelId){a.push({code:"self-identifying",opIndex:s,handle:{from:r.spec.from,to:r.spec.to}});break}const u=i(),f={modelId:u,...r.spec.identifying!=null?{identifying:r.spec.identifying}:{},end1:{entityRef:c.value.modelId,multiplicity:r.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:d.value.modelId,multiplicity:r.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:r.spec.composition??!1}};l.push({kind:"association.add",casUnit:"logical",associationRef:u,value:f});break}case"association.remove":{const c=at(e,r.association.from),d=at(e,r.association.to);if(c.ok||a.push(rt(c.reason,s,r.association.from,c.matches)),d.ok||a.push(rt(d.reason,s,r.association.to,d.matches)),!c.ok||!d.ok)break;const u=yr(e,c.value.modelId,d.value.modelId);if(u.length!==1){a.push(u.length===0?{code:"association-not-found",opIndex:s,handle:r.association}:{code:"association-ambiguous",opIndex:s,handle:r.association,matches:u.map(f=>f.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:u[0].modelId});break}case"association.update":{const c=br(e,r.association,s,a);if(!c)break;l.push({kind:"association.update",casUnit:"logical",containerRef:c.modelId,associationRef:c.modelId,patch:r.patch});break}case"associationEnd.update":{const c=br(e,r.association,s,a);if(!c)break;const d=r.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:c.modelId,associationRef:c.modelId,end:d,patch:r.patch});break}}}),a.length?{ok:!1,errors:a}:{ok:!0,ops:l}}function rt(e,t,o,i){return e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function br(e,t,o,i){const l=at(e,t.from),a=at(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches)),a.ok||i.push(rt(a.reason,o,t.to,a.matches)),!l.ok||!a.ok)return null;const r=yr(e,l.value.modelId,a.value.modelId);return r.length!==1?(i.push(r.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:r.map(s=>s.modelId)}),null):r[0]}const ku={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xu={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},$u={type:"object",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."}},required:["name"],additionalProperties:!1},Iu={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String)."},identifier:{type:"boolean"},notNull:{type:"boolean"},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 동반이 일반적."}},required:["name","type"],additionalProperties:!1},_r={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Su={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{..._r,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{..._r,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},Cu={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function st(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Ru={"entity.add":st("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":st("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":st("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":st("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":st("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":st("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":st("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":st("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":st("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":st("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]})},vr={anyOf:gr.map(e=>Ru[e])},Vu={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ku,assocHandle:xu,entitySpec:$u,attrSpec:Iu,assocSpec:Su,patch:Cu,symbolicOp:vr}};function Au(e,t,o,i={}){const l=i.mkClientOpId??Se,a=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&a.add(s.containerRef);const r={};if(a.size){r.revs={};for(const s of a)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:l()}}const wr={location:{x:0,y:0},size:{width:220,height:140}};function Er(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Tu=/^[-=_*~\s]{3,}$/;function Mu(e){return e.attrType&&e.attrType!=="NORMAL"||!Tu.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Bu(e,t){return e.attrType==="DIVIDER"||Mu(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Er)}}function Du(e){const{modelId:t,name:o,visibility:i,sourceCode:l,description:a,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:l,description:a?{ko:a}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Ou(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function Lu(e){var t,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Bu),operations:(t=e.operations)==null?void 0:t.map(Du),indexes:(o=e.indexes)==null?void 0:o.map(Ou),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Pu(e){const t={};for(const i of e.attributes)i.style&&(t[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...wr},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function Nr(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 ol(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:Nr(e)}}function zu(e){var i,l;const t={modelId:e.modelId,description:e.description,end1:ol(e.end1),end2:ol(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(l=e.end2.attribute)==null?void 0:l.modelId,style:e.style};return{assoc:t,layout:o}}function kr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function $r(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Ir(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Er)}}function Uu(e,t,o){var k,b;const i=kr(e.end1.attribute),l=kr(e.end2.attribute);if(i===l)return zu(e);const a=i?e.end1:e.end2,r=i?e.end2:e.end1,s=a.attribute,c=(b=(k=s.dbAttrs)==null?void 0:k[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce(($,h)=>Math.max($,h.order),-1)+1:s.order??0,p={...Ir(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=($,h)=>({entityRef:$.endModel.refId,multiplicity:$.multiplicity,navigable:$.navigable,composition:$.composition,attributeRef:h?d:p.modelId,legacyNavRaw:h?void 0:$.attribute,jpa:Nr($)}),g={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,l)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:g.end1.attributeRef,targetColumnRef:g.end2.attributeRef,style:e.style};return{assoc:g,layout:_}}function Hu(e,t){const o=e.targetModelId?t.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function Fu(e,t,o){var g;const i=((g=e.end1.attribute)==null?void 0:g.attrType)==="EMBED_OWN",l=i?e.end1:e.end2,a=i?e.end2:e.end1,r=l.attribute,s=t.get(a.endModel.refId),c=s?s.attributes.reduce((_,k)=>Math.max(_,k.order),-1)+1:r.order??0,d={...Ir(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(_=>Hu(_,o)),embedded:{associationRef:e.modelId,embeddableRef:l.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...ol(_),legacyEmbedRaw:_.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Gu(e,t){var i,l,a,r;const o=[];for(const s of t){const c=(l=(i=s.end1)==null?void 0:i.endModel)==null?void 0:l.refId,d=(r=(a=s.end2)==null?void 0:a.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Sr(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:l,style:a,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=Gu(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:l.location.x+t.x,y:l.location.y+t.y},size:l.size},style:a,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Yu(e){return(e.schemaVersion??1)>=2&&"logical"in e?Wu(e):Ku(e)}function Wu(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},l=e.logical.entities.map(i),a=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:l,associations:a,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Ku(e){var b,$;const t=e.id??"",o=[],i=[],l=[],a=[],r=[],s=[],c=[],d=(h,S)=>{o.push(Lu(h));const X=Pu(h);X.geo={location:{x:X.geo.location.x+S.x,y:X.geo.location.y+S.y},size:X.geo.size},i.push(X);for(const W of h.ownedAssociations??[])c.push(W)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const f=[];for(const h of e.groups??[]){const S=h.entities??[];r.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:S.map(W=>W.modelId)});const X=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const W=(h.notes??[]).map(J=>J.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,memberNoteRefs:W.length?W:void 0})}for(const W of S)d(W,X);for(const W of h.notes??[])f.push(Sr(W,X))}const p=new Map(o.map(h=>[h.modelId,h])),m=new Map,g=new Map;for(const h of o)for(const S of h.attributes)for(const X of S.dbAttrs)m.set(X.modelId,S.modelId),g.set(X.modelId,X);for(const h of c)for(const S of[h.end1,h.end2]){const X=S.attribute;if(X&&((($=X.dbAttrs)==null?void 0:$.length)??0)>0)for(const W of X.dbAttrs)W.modelId&&m.set(W.modelId,X.modelId)}for(const h of c){const S=xr(h.end1.attribute),X=xr(h.end2.attribute),W=$r(h.end1)||$r(h.end2),{assoc:J,layout:T}=S!==X||W?Fu(h,p,g):Uu(h,p,m);l.push(J),a.push(T)}const _={logical:{modelId:t,packageName:e.packageName,entities:o,associations:l,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:a,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Sr(h)),...f]}},k={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:k}}function Cr(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Xu(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Cr),style:t}}function qu(e,t){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:t}}function Zu(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ct(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function ju(e,t){const o=t==null?void 0:t.attributes.find(i=>{var l;return i.modelId===((l=e.derivedFrom)==null?void 0:l.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,l)=>{var a;return{...Cr(i),targetModelId:(a=o==null?void 0:o.dbAttrs[l])==null?void 0:a.modelId}})}}function Ju(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function Qu(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function ef(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function tf(e,t){const o=(i,l)=>i===l?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:ef(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function nf(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var g;return((g=m.embedded)==null?void 0:g.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const l=i.embedded.embeddableRef,a=t.logical.entities.find(f=>f.modelId===l);if(!a)return;const r=a.attributes.flatMap(f=>f.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((f,p)=>tf(f,r[p]))},c=e.end1.entityRef===l,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ct(e.end1,c?s:u),end2:Ct(e.end2,c?u:s)}}function of(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ct(e.end1,e.end1.legacyEmbedRaw),end2:Ct(e.end2,e.end2.legacyEmbedRaw)};const l=nf(e,t,i);if(l)return l;const a=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(a!==r){const s=a?e.end1:e.end2,c=a?e.end2:e.end1,d=t.logical.entities.find(g=>g.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(g=>g.modelId===s.attributeRef),f=t.logical.entities.find(g=>g.modelId===c.entityRef),p=u?ju(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ct(e.end1,a?m:p),end2:Ct(e.end2,r?m:p)}}return{...i,end1:Ct(e.end1),end2:Ct(e.end2)}}function Rr(e,t,o,i,l={x:0,y:0}){var u,f;const a=t.layout.entityLayouts.find(p=>p.entityRef===e.modelId),r=t.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>t.layout.associationLayouts.find(m=>m.associationRef===p),c=(a==null?void 0:a.geo)??{...wr},d={location:{x:c.location.x-l.x,y:c.location.y-l.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 m;return Xu(p,(m=a==null?void 0:a.attributeStyles)==null?void 0:m[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var m;return qu(p,(m=a==null?void 0:a.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>of(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Zu),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:a==null?void 0:a.style,collapsed:a==null?void 0:a.collapsed}}function lf(e,t,o,i){const l=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),a=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(l==null?void 0:l.geo.location)??{x:0,y:0},s=((l==null?void 0:l.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Vr(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:a.map(c=>Rr(c,t,o,i,r)),notes:s.length?s:void 0,geo:l==null?void 0:l.geo,style:l==null?void 0:l.style}}function Vr(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function af(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),l=Ju(e),a=Qu(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>Rr(s,e,l,a)),groups:e.logical.groups.map(s=>lf(s,e,l,a)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Vr(s))}}function rf(e,t={}){var l,a,r;const o=((l=t.revSeed)==null?void 0:l.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((a=t.revSeed)==null?void 0:a.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:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function Rn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function bt(e){return typeof e=="function"?e():n.unref(e)}const sf=typeof window<"u"&&typeof document<"u",cf=e=>typeof e<"u",df=Object.prototype.toString,uf=e=>df.call(e)==="[object Object]",ff=()=>{};function mf(e,t){function o(...i){return new Promise((l,a)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(l).catch(a)})}return o}const Ar=e=>e();function pf(e=Ar){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const l=(...a)=>{t.value&&e(...a)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:l}}function Tr(e,t=!1,o="Timeout"){return new Promise((i,l)=>{setTimeout(t?()=>l(o):i,e)})}function hf(e,t,o={}){const{eventFilter:i=Ar,...l}=o;return n.watch(e,mf(i,t),l)}function sn(e,t,o={}){const{eventFilter:i,...l}=o,{eventFilter:a,pause:r,resume:s,isActive:c}=pf(i);return{stop:hf(e,t,{...l,eventFilter:a}),pause:r,resume:s,isActive:c}}function gf(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(l){var a;if((a=bt(t.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=l,e.value=s}else{const s={...e.value,[i]:l};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=l}}));return o}function il(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:g,throwOnTimeout:_}={}){let k=null;const $=[new Promise(h=>{k=n.watch(e,S=>{f(S)!==t&&(k==null||k(),h(S))},{flush:p,deep:m,immediate:!0})})];return g!=null&&$.push(Tr(g,_).then(()=>bt(e)).finally(()=>k==null?void 0:k())),Promise.race($)}function i(f,p){if(!n.isRef(f))return o(S=>S===f,p);const{flush:m="sync",deep:g=!1,timeout:_,throwOnTimeout:k}=p??{};let b=null;const h=[new Promise(S=>{b=n.watch([e,f],([X,W])=>{t!==(X===W)&&(b==null||b(),S(X))},{flush:m,deep:g,immediate:!0})})];return _!=null&&h.push(Tr(_,k).then(()=>bt(e)).finally(()=>(b==null||b(),bt(e)))),Promise.race(h)}function l(f){return o(p=>!!p,f)}function a(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,p){return o(m=>{const g=Array.from(m);return g.includes(f)||g.includes(bt(f))},p)}function d(f){return u(1,f)}function u(f=1,p){let m=-1;return o(()=>(m+=1,m>=f),p)}return Array.isArray(bt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return il(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:l,toBeNull:a,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return il(e,!t)}}}function ll(e){return il(e)}function yf(e){var t;const o=bt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Mr=sf?window:void 0;function Br(...e){let t,o,i,l;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,l]=e,t=Mr):[t,o,i,l]=e,!t)return ff;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const a=[],r=()=>{a.forEach(u=>u()),a.length=0},s=(u,f,p,m)=>(u.addEventListener(f,p,m),()=>u.removeEventListener(f,p,m)),c=n.watch(()=>[yf(t),bt(l)],([u,f])=>{if(r(),!u)return;const p=uf(f)?{...f}:f;a.push(...o.flatMap(m=>i.map(g=>s(u,m,g,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Rn(d),d}function bf(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Dr(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:l=Mr,eventName:a="keydown",passive:r=!1,dedupe:s=!1}=i,c=bf(t);return Br(l,a,u=>{u.repeat&&bt(s)||c(u)&&o(u)},r)}function _f(e){return JSON.parse(JSON.stringify(e))}function al(e,t,o,i={}){var l,a,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),g=o||(m==null?void 0:m.emit)||((l=m==null?void 0:m.$emit)==null?void 0:l.bind(m))||((r=(a=m==null?void 0:m.proxy)==null?void 0:a.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let _=d;t||(t="modelValue"),_=_||`update:${t.toString()}`;const k=h=>s?typeof s=="function"?s(h):_f(h):h,b=()=>cf(e[t])?k(e[t]):f,$=h=>{p?p(h)&&g(_,h):g(_,h)};if(c){const h=b(),S=n.ref(h);let X=!1;return n.watch(()=>e[t],W=>{X||(X=!0,S.value=k(W),n.nextTick(()=>X=!1))}),n.watch(S,W=>{!X&&(W!==e[t]||u)&&$(W)},{deep:u}),S}else return n.computed({get(){return b()},set(h){$(h)}})}var vf={value:()=>{}};function ko(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new xo(o)}function xo(e){this._=e}function wf(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}xo.prototype=ko.prototype={constructor:xo,on:function(e,t){var o=this._,i=wf(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=Ef(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=Or(o[l],e.name,t);else if(t==null)for(l in o)o[l]=Or(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new xo(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function Ef(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function Or(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=vf,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var rl="http://www.w3.org/1999/xhtml";const Lr={svg:"http://www.w3.org/2000/svg",xhtml:rl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $o(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Lr.hasOwnProperty(t)?{space:Lr[t],local:e}:e}function Nf(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===rl&&t.documentElement.namespaceURI===rl?t.createElement(e):t.createElementNS(o,e)}}function kf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pr(e){var t=$o(e);return(t.local?kf:Nf)(t)}function xf(){}function sl(e){return e==null?xf:function(){return this.querySelector(e)}}function $f(e){typeof e!="function"&&(e=sl(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),c,d,u=0;u<r;++u)(c=a[u])&&(d=e.call(c,c.__data__,u,a))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Xe(i,this._parents)}function If(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Sf(){return[]}function zr(e){return e==null?Sf:function(){return this.querySelectorAll(e)}}function Cf(e){return function(){return If(e.apply(this,arguments))}}function Rf(e){typeof e=="function"?e=Cf(e):e=zr(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),l.push(c));return new Xe(i,l)}function Ur(e){return function(){return this.matches(e)}}function Hr(e){return function(t){return t.matches(e)}}var Vf=Array.prototype.find;function Af(e){return function(){return Vf.call(this.children,e)}}function Tf(){return this.firstElementChild}function Mf(e){return this.select(e==null?Tf:Af(typeof e=="function"?e:Hr(e)))}var Bf=Array.prototype.filter;function Df(){return Array.from(this.children)}function Of(e){return function(){return Bf.call(this.children,e)}}function Lf(e){return this.selectAll(e==null?Df:Of(typeof e=="function"?e:Hr(e)))}function Pf(e){typeof e!="function"&&(e=Ur(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new Xe(i,this._parents)}function Fr(e){return new Array(e.length)}function zf(){return new Xe(this._enter||this._groups.map(Fr),this._parents)}function Io(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Io.prototype={constructor:Io,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Uf(e){return function(){return e}}function Hf(e,t,o,i,l,a){for(var r=0,s,c=t.length,d=a.length;r<d;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new Io(e,a[r]);for(;r<c;++r)(s=t[r])&&(l[r]=s)}function Ff(e,t,o,i,l,a,r){var s,c,d=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?l[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(c=d.get(m))?(i[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new Io(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(l[s]=c)}function Gf(e){return e.__data__}function Yf(e,t){if(!arguments.length)return Array.from(this,Gf);var o=t?Ff:Hf,i=this._parents,l=this._groups;typeof e!="function"&&(e=Uf(e));for(var a=l.length,r=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var u=i[d],f=l[d],p=f.length,m=Wf(e.call(u,u&&u.__data__,d,i)),g=m.length,_=s[d]=new Array(g),k=r[d]=new Array(g),b=c[d]=new Array(p);o(u,f,_,k,b,m,t);for(var $=0,h=0,S,X;$<g;++$)if(S=_[$]){for($>=h&&(h=$+1);!(X=k[h])&&++h<g;);S._next=X||null}}return r=new Xe(r,i),r._enter=s,r._exit=c,r}function Wf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Kf(){return new Xe(this._exit||this._groups.map(Fr),this._parents)}function Xf(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function qf(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,g=0;g<f;++g)(m=d[g]||u[g])&&(p[g]=m);for(;c<l;++c)s[c]=o[c];return new Xe(s,this._parents)}function Zf(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function jf(e){e||(e=Jf);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,c=l[a]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new Xe(l,this._parents).order()}function Jf(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function em(){return Array.from(this)}function tm(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function nm(){let e=0;for(const t of this)++e;return e}function om(){return!this.node()}function im(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function lm(e){return function(){this.removeAttribute(e)}}function am(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rm(e,t){return function(){this.setAttribute(e,t)}}function sm(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cm(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function dm(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function um(e,t){var o=$o(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?am:lm:typeof t=="function"?o.local?dm:cm:o.local?sm:rm)(o,t))}function Gr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fm(e){return function(){this.style.removeProperty(e)}}function mm(e,t,o){return function(){this.style.setProperty(e,t,o)}}function pm(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function hm(e,t,o){return arguments.length>1?this.each((t==null?fm:typeof t=="function"?pm:mm)(e,t,o??"")):cn(this.node(),e)}function cn(e,t){return e.style.getPropertyValue(t)||Gr(e).getComputedStyle(e,null).getPropertyValue(t)}function gm(e){return function(){delete this[e]}}function ym(e,t){return function(){this[e]=t}}function bm(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function _m(e,t){return arguments.length>1?this.each((t==null?gm:typeof t=="function"?bm:ym)(e,t)):this.node()[e]}function Yr(e){return e.trim().split(/^|\s+/)}function cl(e){return e.classList||new Wr(e)}function Wr(e){this._node=e,this._names=Yr(e.getAttribute("class")||"")}Wr.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Kr(e,t){for(var o=cl(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function Xr(e,t){for(var o=cl(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function vm(e){return function(){Kr(this,e)}}function wm(e){return function(){Xr(this,e)}}function Em(e,t){return function(){(t.apply(this,arguments)?Kr:Xr)(this,e)}}function Nm(e,t){var o=Yr(e+"");if(arguments.length<2){for(var i=cl(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?Em:t?vm:wm)(o,t))}function km(){this.textContent=""}function xm(e){return function(){this.textContent=e}}function $m(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Im(e){return arguments.length?this.each(e==null?km:(typeof e=="function"?$m:xm)(e)):this.node().textContent}function Sm(){this.innerHTML=""}function Cm(e){return function(){this.innerHTML=e}}function Rm(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vm(e){return arguments.length?this.each(e==null?Sm:(typeof e=="function"?Rm:Cm)(e)):this.node().innerHTML}function Am(){this.nextSibling&&this.parentNode.appendChild(this)}function Tm(){return this.each(Am)}function Mm(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bm(){return this.each(Mm)}function Dm(e){var t=typeof e=="function"?e:Pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Om(){return null}function Lm(e,t){var o=typeof e=="function"?e:Pr(e),i=t==null?Om:typeof t=="function"?t:sl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Pm(){var e=this.parentNode;e&&e.removeChild(this)}function zm(){return this.each(Pm)}function Um(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hm(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fm(e){return this.select(e?Hm:Um)}function Gm(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ym(e){return function(t){e.call(this,t,this.__data__)}}function Wm(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Km(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function Xm(e,t,o){return function(){var i=this.__on,l,a=Ym(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function qm(e,t,o){var i=Wm(e+""),l,a=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(l=0,u=s[c];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?Xm:Km,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function qr(e,t,o){var i=Gr(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function Zm(e,t){return function(){return qr(this,e,t)}}function jm(e,t){return function(){return qr(this,e,t.apply(this,arguments))}}function Jm(e,t){return this.each((typeof t=="function"?jm:Zm)(e,t))}function*Qm(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var Zr=[null];function Xe(e,t){this._groups=e,this._parents=t}function Vn(){return new Xe([[document.documentElement]],Zr)}function ep(){return this}Xe.prototype=Vn.prototype={constructor:Xe,select:$f,selectAll:Rf,selectChild:Mf,selectChildren:Lf,filter:Pf,data:Yf,enter:zf,exit:Kf,join:Xf,merge:qf,selection:ep,order:Zf,sort:jf,call:Qf,nodes:em,node:tm,size:nm,empty:om,each:im,attr:um,style:hm,property:_m,classed:Nm,text:Im,html:Vm,raise:Tm,lower:Bm,append:Dm,insert:Lm,remove:zm,clone:Fm,datum:Gm,on:qm,dispatch:Jm,[Symbol.iterator]:Qm};function Je(e){return typeof e=="string"?new Xe([[document.querySelector(e)]],[document.documentElement]):new Xe([[e]],Zr)}function tp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ct(e,t){if(e=tp(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const np={passive:!1},An={capture:!0,passive:!1};function dl(e){e.stopImmediatePropagation()}function dn(e){e.preventDefault(),e.stopImmediatePropagation()}function jr(e){var t=e.document.documentElement,o=Je(e).on("dragstart.drag",dn,An);"onselectstart"in t?o.on("selectstart.drag",dn,An):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Jr(e,t){var o=e.document.documentElement,i=Je(e).on("dragstart.drag",null);t&&(i.on("click.drag",dn,An),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 So=e=>()=>e;function ul(e,{sourceEvent:t,subject:o,target:i,identifier:l,active:a,x:r,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:r,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}})}ul.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function op(e){return!e.ctrlKey&&!e.button}function ip(){return this.parentNode}function lp(e,t){return t??{x:e.x,y:e.y}}function ap(){return navigator.maxTouchPoints||"ontouchstart"in this}function rp(){var e=op,t=ip,o=lp,i=ap,l={},a=ko("start","drag","end"),r=0,s,c,d,u,f=0;function p(S){S.on("mousedown.drag",m).filter(i).on("touchstart.drag",k).on("touchmove.drag",b,np).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(S,X){if(!(u||!e.call(this,S,X))){var W=h(this,t.call(this,S,X),S,X,"mouse");W&&(Je(S.view).on("mousemove.drag",g,An).on("mouseup.drag",_,An),jr(S.view),dl(S),d=!1,s=S.clientX,c=S.clientY,W("start",S))}}function g(S){if(dn(S),!d){var X=S.clientX-s,W=S.clientY-c;d=X*X+W*W>f}l.mouse("drag",S)}function _(S){Je(S.view).on("mousemove.drag mouseup.drag",null),Jr(S.view,d),dn(S),l.mouse("end",S)}function k(S,X){if(e.call(this,S,X)){var W=S.changedTouches,J=t.call(this,S,X),T=W.length,ee,F;for(ee=0;ee<T;++ee)(F=h(this,J,S,X,W[ee].identifier,W[ee]))&&(dl(S),F("start",S,W[ee]))}}function b(S){var X=S.changedTouches,W=X.length,J,T;for(J=0;J<W;++J)(T=l[X[J].identifier])&&(dn(S),T("drag",S,X[J]))}function $(S){var X=S.changedTouches,W=X.length,J,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),J=0;J<W;++J)(T=l[X[J].identifier])&&(dl(S),T("end",S,X[J]))}function h(S,X,W,J,T,ee){var F=a.copy(),K=ct(ee||W,X),O,fe,w;if((w=o.call(S,new ul("beforestart",{sourceEvent:W,target:p,identifier:T,active:r,x:K[0],y:K[1],dx:0,dy:0,dispatch:F}),J))!=null)return O=w.x-K[0]||0,fe=w.y-K[1]||0,function R(x,G,H){var Z=K,A;switch(x){case"start":l[T]=R,A=r++;break;case"end":delete l[T],--r;case"drag":K=ct(H||G,X),A=r;break}F.call(x,S,new ul(x,{sourceEvent:G,subject:w,target:p,identifier:T,active:A,x:K[0]+O,y:K[1]+fe,dx:K[0]-Z[0],dy:K[1]-Z[1],dispatch:F}),J)}}return p.filter=function(S){return arguments.length?(e=typeof S=="function"?S:So(!!S),p):e},p.container=function(S){return arguments.length?(t=typeof S=="function"?S:So(S),p):t},p.subject=function(S){return arguments.length?(o=typeof S=="function"?S:So(S),p):o},p.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:So(!!S),p):i},p.on=function(){var S=a.on.apply(a,arguments);return S===a?p:S},p.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,p):Math.sqrt(f)},p}function fl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Qr(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Tn(){}var Mn=.7,Co=1/Mn,un="\\s*([+-]?\\d+)\\s*",Bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sp=/^#([0-9a-f]{3,8})$/,cp=new RegExp(`^rgb\\(${un},${un},${un}\\)$`),dp=new RegExp(`^rgb\\(${dt},${dt},${dt}\\)$`),up=new RegExp(`^rgba\\(${un},${un},${un},${Bn}\\)$`),fp=new RegExp(`^rgba\\(${dt},${dt},${dt},${Bn}\\)$`),mp=new RegExp(`^hsl\\(${Bn},${dt},${dt}\\)$`),pp=new RegExp(`^hsla\\(${Bn},${dt},${dt},${Bn}\\)$`),es={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};fl(Tn,Ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ts,formatHex:ts,formatHex8:hp,formatHsl:gp,formatRgb:ns,toString:ns});function ts(){return this.rgb().formatHex()}function hp(){return this.rgb().formatHex8()}function gp(){return rs(this).formatHsl()}function ns(){return this.rgb().formatRgb()}function Ut(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=sp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?os(t):o===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Ro(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Ro(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=cp.exec(e))?new Ye(t[1],t[2],t[3],1):(t=dp.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=up.exec(e))?Ro(t[1],t[2],t[3],t[4]):(t=fp.exec(e))?Ro(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mp.exec(e))?as(t[1],t[2]/100,t[3]/100,1):(t=pp.exec(e))?as(t[1],t[2]/100,t[3]/100,t[4]):es.hasOwnProperty(e)?os(es[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function os(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function Ro(e,t,o,i){return i<=0&&(e=t=o=NaN),new Ye(e,t,o,i)}function yp(e){return e instanceof Tn||(e=Ut(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function ml(e,t,o,i){return arguments.length===1?yp(e):new Ye(e,t,o,i??1)}function Ye(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}fl(Ye,ml,Qr(Tn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mn:Math.pow(Mn,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Ht(this.r),Ht(this.g),Ht(this.b),Vo(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:is,formatHex:is,formatHex8:bp,formatRgb:ls,toString:ls}));function is(){return`#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}`}function bp(){return`#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}${Ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function ls(){const e=Vo(this.opacity);return`${e===1?"rgb(":"rgba("}${Ht(this.r)}, ${Ht(this.g)}, ${Ht(this.b)}${e===1?")":`, ${e})`}`}function Vo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ht(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ft(e){return e=Ht(e),(e<16?"0":"")+e.toString(16)}function as(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new Qe(e,t,o,i)}function rs(e){if(e instanceof Qe)return new Qe(e.h,e.s,e.l,e.opacity);if(e instanceof Tn||(e=Ut(e)),!e)return new Qe;if(e instanceof Qe)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,c=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?a+l:2-a-l,r*=60):s=c>0&&c<1?0:r,new Qe(r,s,c,e.opacity)}function _p(e,t,o,i){return arguments.length===1?rs(e):new Qe(e,t,o,i??1)}function Qe(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}fl(Qe,_p,Qr(Tn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new Qe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mn:Math.pow(Mn,e),new Qe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new Ye(pl(e>=240?e-240:e+120,l,i),pl(e,l,i),pl(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new Qe(ss(this.h),Ao(this.s),Ao(this.l),Vo(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=Vo(this.opacity);return`${e===1?"hsl(":"hsla("}${ss(this.h)}, ${Ao(this.s)*100}%, ${Ao(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ss(e){return e=(e||0)%360,e<0?e+360:e}function Ao(e){return Math.max(0,Math.min(1,e||0))}function pl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const hl=e=>()=>e;function vp(e,t){return function(o){return e+o*t}}function wp(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Ep(e){return(e=+e)==1?cs:function(t,o){return o-t?wp(t,o,e):hl(isNaN(t)?o:t)}}function cs(e,t){var o=t-e;return o?vp(e,o):hl(isNaN(e)?t:e)}const To=(function e(t){var o=Ep(t);function i(l,a){var r=o((l=ml(l)).r,(a=ml(a)).r),s=o(l.g,a.g),c=o(l.b,a.b),d=cs(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=c(u),l.opacity=d(u),l+""}}return i.gamma=e,i})(1);function Np(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),l;return function(a){for(l=0;l<o;++l)i[l]=e[l]*(1-a)+t[l]*a;return i}}function kp(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xp(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,l=new Array(i),a=new Array(o),r;for(r=0;r<i;++r)l[r]=Dn(e[r],t[r]);for(;r<o;++r)a[r]=t[r];return function(s){for(r=0;r<i;++r)a[r]=l[r](s);return a}}function $p(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function ut(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ip(e,t){var o={},i={},l;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(l in t)l in e?o[l]=Dn(e[l],t[l]):i[l]=t[l];return function(a){for(l in o)i[l]=o[l](a);return i}}var gl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yl=new RegExp(gl.source,"g");function Sp(e){return function(){return e}}function Cp(e){return function(t){return e(t)+""}}function ds(e,t){var o=gl.lastIndex=yl.lastIndex=0,i,l,a,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=gl.exec(e))&&(l=yl.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,c.push({i:r,x:ut(i,l)})),o=yl.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?c[0]?Cp(c[0].x):Sp(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}function Dn(e,t){var o=typeof t,i;return t==null||o==="boolean"?hl(t):(o==="number"?ut:o==="string"?(i=Ut(t))?(t=i,To):ds:t instanceof Ut?To:t instanceof Date?$p:kp(t)?Np:Array.isArray(t)?xp:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ip:ut)(e,t)}var us=180/Math.PI,bl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fs(e,t,o,i,l,a){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*us,skewX:Math.atan(c)*us,scaleX:r,scaleY:s}}var Mo;function Rp(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?bl:fs(t.a,t.b,t.c,t.d,t.e,t.f)}function Vp(e){return e==null||(Mo||(Mo=document.createElementNS("http://www.w3.org/2000/svg","g")),Mo.setAttribute("transform",e),!(e=Mo.transform.baseVal.consolidate()))?bl:(e=e.matrix,fs(e.a,e.b,e.c,e.d,e.e,e.f))}function ms(e,t,o,i){function l(d){return d.length?d.pop()+" ":""}function a(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);g.push({i:_-4,x:ut(d,f)},{i:_-2,x:ut(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:ut(d,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:ut(d,u)}):u&&f.push(l(f)+"skewX("+u+i)}function c(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push(l(m)+"scale(",null,",",null,")");g.push({i:_-4,x:ut(d,f)},{i:_-2,x:ut(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),a(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var g=-1,_=p.length,k;++g<_;)f[(k=p[g]).i]=k.x(m);return f.join("")}}}var Ap=ms(Rp,"px, ","px)","deg)"),Tp=ms(Vp,", ",")",")"),Mp=1e-12;function ps(e){return((e=Math.exp(e))+1/e)/2}function Bp(e){return((e=Math.exp(e))-1/e)/2}function Dp(e){return((e=Math.exp(2*e))-1)/(e+1)}const Bo=(function e(t,o,i){function l(a,r){var s=a[0],c=a[1],d=a[2],u=r[0],f=r[1],p=r[2],m=u-s,g=f-c,_=m*m+g*g,k,b;if(_<Mp)b=Math.log(p/d)/t,k=function(J){return[s+J*m,c+J*g,d*Math.exp(t*J*b)]};else{var $=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*$),S=(p*p-d*d-i*_)/(2*p*o*$),X=Math.log(Math.sqrt(h*h+1)-h),W=Math.log(Math.sqrt(S*S+1)-S);b=(W-X)/t,k=function(J){var T=J*b,ee=ps(X),F=d/(o*$)*(ee*Dp(t*T+X)-Bp(X));return[s+F*m,c+F*g,d*ee/ps(t*T+X)]}}return k.duration=b*1e3*t/Math.SQRT2,k}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,c=s*s;return e(r,s,c)},l})(Math.SQRT2,2,4);var fn=0,On=0,Ln=0,hs=1e3,Do,Pn,Oo=0,Gt=0,Lo=0,zn=typeof performance=="object"&&performance.now?performance:Date,gs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _l(){return Gt||(gs(Op),Gt=zn.now()+Lo)}function Op(){Gt=0}function Po(){this._call=this._time=this._next=null}Po.prototype=ys.prototype={constructor:Po,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?_l():+o)+(t==null?0:+t),!this._next&&Pn!==this&&(Pn?Pn._next=this:Do=this,Pn=this),this._call=e,this._time=o,vl()},stop:function(){this._call&&(this._call=null,this._time=1/0,vl())}};function ys(e,t,o){var i=new Po;return i.restart(e,t,o),i}function Lp(){_l(),++fn;for(var e=Do,t;e;)(t=Gt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--fn}function bs(){Gt=(Oo=zn.now())+Lo,fn=On=0;try{Lp()}finally{fn=0,zp(),Gt=0}}function Pp(){var e=zn.now(),t=e-Oo;t>hs&&(Lo-=t,Oo=e)}function zp(){for(var e,t=Do,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Do=o);Pn=e,vl(i)}function vl(e){if(!fn){On&&(On=clearTimeout(On));var t=e-Gt;t>24?(e<1/0&&(On=setTimeout(bs,e-zn.now()-Lo)),Ln&&(Ln=clearInterval(Ln))):(Ln||(Oo=zn.now(),Ln=setInterval(Pp,hs)),fn=1,gs(bs))}}function _s(e,t,o){var i=new Po;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var Up=ko("start","end","cancel","interrupt"),Hp=[],vs=0,ws=1,wl=2,zo=3,Es=4,El=5,Uo=6;function Ho(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Fp(e,o,{name:t,index:i,group:l,on:Up,tween:Hp,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:vs})}function Nl(e,t){var o=et(e,t);if(o.state>vs)throw new Error("too late; already scheduled");return o}function ft(e,t){var o=et(e,t);if(o.state>zo)throw new Error("too late; already running");return o}function et(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Fp(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=ys(a,0,o.time);function a(d){o.state=ws,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==ws)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===zo)return _s(r);m.state===Es?(m.state=Uo,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Uo,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(_s(function(){o.state===zo&&(o.state=Es,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=wl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===wl){for(o.state=zo,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=El,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===El&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Uo,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Fo(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>wl&&i.state<El,i.state=Uo,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function Gp(e){return this.each(function(){Fo(this,e)})}function Yp(e,t){var o,i;return function(){var l=ft(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function Wp(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=ft(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},c=0,d=l.length;c<d;++c)if(l[c].name===t){l[c]=s;break}c===d&&l.push(s)}a.tween=l}}function Kp(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=et(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?Yp:Wp)(o,e,t))}function kl(e,t,o){var i=e._id;return e.each(function(){var l=ft(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return et(l,i).value[t]}}function Ns(e,t){var o;return(typeof t=="number"?ut:t instanceof Ut?To:(o=Ut(t))?(t=o,To):ds)(e,t)}function Xp(e){return function(){this.removeAttribute(e)}}function qp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zp(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function jp(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function Jp(e,t,o){var i,l,a;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s)))}}function Qp(e,t,o){var i,l,a;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s)))}}function eh(e,t){var o=$o(e),i=o==="transform"?Tp:Ns;return this.attrTween(e,typeof t=="function"?(o.local?Qp:Jp)(o,i,kl(this,"attr."+e,t)):t==null?(o.local?qp:Xp)(o):(o.local?jp:Zp)(o,i,t))}function th(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function nh(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function oh(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&nh(e,a)),o}return l._value=t,l}function ih(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&th(e,a)),o}return l._value=t,l}function lh(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=$o(e);return this.tween(o,(i.local?oh:ih)(i,t))}function ah(e,t){return function(){Nl(this,e).delay=+t.apply(this,arguments)}}function rh(e,t){return t=+t,function(){Nl(this,e).delay=t}}function sh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ah:rh)(t,e)):et(this.node(),t).delay}function ch(e,t){return function(){ft(this,e).duration=+t.apply(this,arguments)}}function dh(e,t){return t=+t,function(){ft(this,e).duration=t}}function uh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ch:dh)(t,e)):et(this.node(),t).duration}function fh(e,t){if(typeof t!="function")throw new Error;return function(){ft(this,e).ease=t}}function mh(e){var t=this._id;return arguments.length?this.each(fh(t,e)):et(this.node(),t).ease}function ph(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ft(this,e).ease=o}}function hh(e){if(typeof e!="function")throw new Error;return this.each(ph(this._id,e))}function gh(e){typeof e!="function"&&(e=Ur(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new _t(i,this._parents,this._name,this._id)}function yh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new _t(r,this._parents,this._name,this._id)}function bh(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function _h(e,t,o){var i,l,a=bh(t)?Nl:ft;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function vh(e,t){var o=this._id;return arguments.length<2?et(this.node(),o).on.on(e):this.each(_h(o,e,t))}function wh(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Eh(){return this.on("end.remove",wh(this._id))}function Nh(e){var t=this._name,o=this._id;typeof e!="function"&&(e=sl(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],c=s.length,d=a[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Ho(d[p],t,o,p,d,et(u,o)));return new _t(a,this._parents,t,o)}function kh(e){var t=this._name,o=this._id;typeof e!="function"&&(e=zr(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,g=et(u,o),_=0,k=p.length;_<k;++_)(m=p[_])&&Ho(m,t,o,_,p,g);a.push(p),r.push(u)}return new _t(a,r,t,o)}var xh=Vn.prototype.constructor;function $h(){return new xh(this._groups,this._parents)}function Ih(e,t){var o,i,l;return function(){var a=cn(this,e),r=(this.style.removeProperty(e),cn(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function ks(e){return function(){this.style.removeProperty(e)}}function Sh(e,t,o){var i,l=o+"",a;return function(){var r=cn(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function Ch(e,t,o){var i,l,a;return function(){var r=cn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),cn(this,e))),r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s))}}function Rh(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var c=ft(this,e),d=c.on,u=c.value[a]==null?s||(s=ks(t)):void 0;(d!==o||l!==u)&&(i=(o=d).copy()).on(r,l=u),c.on=i}}function Vh(e,t,o){var i=(e+="")=="transform"?Ap:Ns;return t==null?this.styleTween(e,Ih(e,i)).on("end.style."+e,ks(e)):typeof t=="function"?this.styleTween(e,Ch(e,i,kl(this,"style."+e,t))).each(Rh(this._id,e)):this.styleTween(e,Sh(e,i,t),o).on("end.style."+e,null)}function Ah(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Th(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&Ah(e,r,o)),i}return a._value=t,a}function Mh(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Th(e,t,o??""))}function Bh(e){return function(){this.textContent=e}}function Dh(e){return function(){var t=e(this);this.textContent=t??""}}function Oh(e){return this.tween("text",typeof e=="function"?Dh(kl(this,"text",e)):Bh(e==null?"":e+""))}function Lh(e){return function(t){this.textContent=e.call(this,t)}}function Ph(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&Lh(l)),t}return i._value=e,i}function zh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Ph(e))}function Uh(){for(var e=this._name,t=this._id,o=xs(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=et(c,t);Ho(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _t(i,this._parents,e,o)}function Hh(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},c={value:function(){--l===0&&a()}};o.each(function(){var d=ft(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),l===0&&a()})}var Fh=0;function _t(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function xs(){return++Fh}var vt=Vn.prototype;_t.prototype={constructor:_t,select:Nh,selectAll:kh,selectChild:vt.selectChild,selectChildren:vt.selectChildren,filter:gh,merge:yh,selection:$h,transition:Uh,call:vt.call,nodes:vt.nodes,node:vt.node,size:vt.size,empty:vt.empty,each:vt.each,on:vh,attr:eh,attrTween:lh,style:Vh,styleTween:Mh,text:Oh,textTween:zh,remove:Eh,tween:Kp,delay:sh,duration:uh,ease:mh,easeVarying:hh,end:Hh,[Symbol.iterator]:vt[Symbol.iterator]};function Gh(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yh={time:null,delay:0,duration:250,ease:Gh};function Wh(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Kh(e){var t,o;e instanceof _t?(t=e._id,e=e._name):(t=xs(),(o=Yh).time=_l(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Ho(c,e,t,d,r,o||Wh(c,t));return new _t(i,this._parents,e,t)}Vn.prototype.interrupt=Gp,Vn.prototype.transition=Kh;const Go=e=>()=>e;function Xh(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function wt(e,t,o){this.k=e,this.x=t,this.y=o}wt.prototype={constructor:wt,scale:function(e){return e===1?this:new wt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new wt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var mn=new wt(1,0,0);wt.prototype;function xl(e){e.stopImmediatePropagation()}function Un(e){e.preventDefault(),e.stopImmediatePropagation()}function qh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zh(){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 $s(){return this.__zoom||mn}function jh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qh(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function eg(){var e=qh,t=Zh,o=Qh,i=jh,l=Jh,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Bo,d=ko("start","zoom","end"),u,f,p,m=500,g=150,_=0,k=10;function b(w){w.property("__zoom",$s).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ee).on("dblclick.zoom",F).filter(l).on("touchstart.zoom",K).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",fe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(w,R,x,G){var H=w.selection?w.selection():w;H.property("__zoom",$s),w!==H?X(w,R,x,G):H.interrupt().each(function(){W(this,arguments).event(G).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(w,R,x,G){b.scaleTo(w,function(){var H=this.__zoom.k,Z=typeof R=="function"?R.apply(this,arguments):R;return H*Z},x,G)},b.scaleTo=function(w,R,x,G){b.transform(w,function(){var H=t.apply(this,arguments),Z=this.__zoom,A=x==null?S(H):typeof x=="function"?x.apply(this,arguments):x,U=Z.invert(A),Q=typeof R=="function"?R.apply(this,arguments):R;return o(h($(Z,Q),A,U),H,r)},x,G)},b.translateBy=function(w,R,x,G){b.transform(w,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof x=="function"?x.apply(this,arguments):x),t.apply(this,arguments),r)},null,G)},b.translateTo=function(w,R,x,G,H){b.transform(w,function(){var Z=t.apply(this,arguments),A=this.__zoom,U=G==null?S(Z):typeof G=="function"?G.apply(this,arguments):G;return o(mn.translate(U[0],U[1]).scale(A.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof x=="function"?-x.apply(this,arguments):-x),Z,r)},G,H)};function $(w,R){return R=Math.max(a[0],Math.min(a[1],R)),R===w.k?w:new wt(R,w.x,w.y)}function h(w,R,x){var G=R[0]-x[0]*w.k,H=R[1]-x[1]*w.k;return G===w.x&&H===w.y?w:new wt(w.k,G,H)}function S(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function X(w,R,x,G){w.on("start.zoom",function(){W(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){W(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,Z=arguments,A=W(H,Z).event(G),U=t.apply(H,Z),Q=x==null?S(U):typeof x=="function"?x.apply(H,Z):x,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),pe=H.__zoom,de=typeof R=="function"?R.apply(H,Z):R,q=c(pe.invert(Q).concat(me/pe.k),de.invert(Q).concat(me/de.k));return function(ce){if(ce===1)ce=de;else{var Ee=q(ce),$e=me/Ee[2];ce=new wt($e,Q[0]-Ee[0]*$e,Q[1]-Ee[1]*$e)}A.zoom(null,ce)}})}function W(w,R,x){return!x&&w.__zooming||new J(w,R)}function J(w,R){this.that=w,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,R),this.taps=0}J.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,R){return this.mouse&&w!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var R=Je(this.that).datum();d.call(w,this.that,new Xh(w,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),R)}};function T(w,...R){if(!e.apply(this,arguments))return;var x=W(this,R).event(w),G=this.__zoom,H=Math.max(a[0],Math.min(a[1],G.k*Math.pow(2,i.apply(this,arguments)))),Z=ct(w);if(x.wheel)(x.mouse[0][0]!==Z[0]||x.mouse[0][1]!==Z[1])&&(x.mouse[1]=G.invert(x.mouse[0]=Z)),clearTimeout(x.wheel);else{if(G.k===H)return;x.mouse=[Z,G.invert(Z)],Fo(this),x.start()}Un(w),x.wheel=setTimeout(A,g),x.zoom("mouse",o(h($(G,H),x.mouse[0],x.mouse[1]),x.extent,r));function A(){x.wheel=null,x.end()}}function ee(w,...R){if(p||!e.apply(this,arguments))return;var x=w.currentTarget,G=W(this,R,!0).event(w),H=Je(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",me,!0),Z=ct(w,x),A=w.clientX,U=w.clientY;jr(w.view),xl(w),G.mouse=[Z,this.__zoom.invert(Z)],Fo(this),G.start();function Q(pe){if(Un(pe),!G.moved){var de=pe.clientX-A,q=pe.clientY-U;G.moved=de*de+q*q>_}G.event(pe).zoom("mouse",o(h(G.that.__zoom,G.mouse[0]=ct(pe,x),G.mouse[1]),G.extent,r))}function me(pe){H.on("mousemove.zoom mouseup.zoom",null),Jr(pe.view,G.moved),Un(pe),G.event(pe).end()}}function F(w,...R){if(e.apply(this,arguments)){var x=this.__zoom,G=ct(w.changedTouches?w.changedTouches[0]:w,this),H=x.invert(G),Z=x.k*(w.shiftKey?.5:2),A=o(h($(x,Z),G,H),t.apply(this,R),r);Un(w),s>0?Je(this).transition().duration(s).call(X,A,G,w):Je(this).call(b.transform,A,G,w)}}function K(w,...R){if(e.apply(this,arguments)){var x=w.touches,G=x.length,H=W(this,R,w.changedTouches.length===G).event(w),Z,A,U,Q;for(xl(w),A=0;A<G;++A)U=x[A],Q=ct(U,this),Q=[Q,this.__zoom.invert(Q),U.identifier],H.touch0?!H.touch1&&H.touch0[2]!==Q[2]&&(H.touch1=Q,H.taps=0):(H.touch0=Q,Z=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),Z&&(H.taps<2&&(f=Q[0],u=setTimeout(function(){u=null},m)),Fo(this),H.start())}}function O(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A,U,Q;for(Un(w),Z=0;Z<H;++Z)A=G[Z],U=ct(A,this),x.touch0&&x.touch0[2]===A.identifier?x.touch0[0]=U:x.touch1&&x.touch1[2]===A.identifier&&(x.touch1[0]=U);if(A=x.that.__zoom,x.touch1){var me=x.touch0[0],pe=x.touch0[1],de=x.touch1[0],q=x.touch1[1],ce=(ce=de[0]-me[0])*ce+(ce=de[1]-me[1])*ce,Ee=(Ee=q[0]-pe[0])*Ee+(Ee=q[1]-pe[1])*Ee;A=$(A,Math.sqrt(ce/Ee)),U=[(me[0]+de[0])/2,(me[1]+de[1])/2],Q=[(pe[0]+q[0])/2,(pe[1]+q[1])/2]}else if(x.touch0)U=x.touch0[0],Q=x.touch0[1];else return;x.zoom("touch",o(h(A,U,Q),x.extent,r))}}function fe(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A;for(xl(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),Z=0;Z<H;++Z)A=G[Z],x.touch0&&x.touch0[2]===A.identifier?delete x.touch0:x.touch1&&x.touch1[2]===A.identifier&&delete x.touch1;if(x.touch1&&!x.touch0&&(x.touch0=x.touch1,delete x.touch1),x.touch0)x.touch0[1]=this.__zoom.invert(x.touch0[0]);else if(x.end(),x.taps===2&&(A=ct(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<k)){var U=Je(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Go(+w),b):i},b.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Go(!!w),b):e},b.touchable=function(w){return arguments.length?(l=typeof w=="function"?w:Go(!!w),b):l},b.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Go([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),b):t},b.scaleExtent=function(w){return arguments.length?(a[0]=+w[0],a[1]=+w[1],b):[a[0],a[1]]},b.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(w){return arguments.length?(o=w,b):o},b.duration=function(w){return arguments.length?(s=+w,b):s},b.interpolate=function(w){return arguments.length?(c=w,b):c},b.on=function(){var w=d.on.apply(d,arguments);return w===d?b:w},b.clickDistance=function(w){return arguments.length?(_=(w=+w)*w,b):Math.sqrt(_)},b.tapDistance=function(w){return arguments.length?(k=+w,b):k},b}var ve=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ve||{}),$l=(e=>(e.Partial="partial",e.Full="full",e))($l||{}),Yt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Yt||{}),Et=(e=>(e.Strict="strict",e.Loose="loose",e))(Et||{}),Il=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Il||{}),Hn=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Hn||{}),Is=(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))(Is||{});const tg=["INPUT","SELECT","TEXTAREA"],ng=typeof document<"u"?document:null;function Sl(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,l=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,a=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return tg.includes(i==null?void 0:i.nodeName)||l||!!a}function og(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ss(e,t,o,i){const l=t.replace("+",`
1
+ (function(Ne,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ne=typeof globalThis<"u"?globalThis:Ne||self,n(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,n,ae){"use strict";var eS=Object.defineProperty;var tS=(Ne,n,ae)=>n in Ne?eS(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Ne[n]=ae;var Fe=(Ne,n,ae)=>tS(Ne,typeof n!="symbol"?n+"":n,ae);const Lu={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Pu(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function Hl(e,t,o={}){const i={...Lu,...o},a=new Map(e.entities.map(y=>[y.modelId,y])),l=new Map(e.associations.map(y=>[y.modelId,y])),r=new Map(t.entityLayouts.map(y=>[y.entityRef,y])),s=new Map(t.associationLayouts.map(y=>[y.associationRef,y])),c=t.entityLayouts.map(y=>y.entityRef).filter(y=>!a.has(y)),d=t.associationLayouts.map(y=>y.associationRef).filter(y=>!l.has(y)),u=new Map;for(const y of e.groups)for(const $ of y.memberEntityRefs)u.set($,y.modelId);const f=new Map;for(const y of t.groupLayouts)for(const $ of y.memberNoteRefs??[])f.set($,y.groupRef);let p=0;const m=e.entities.map(y=>{const $=u.get(y.modelId),K=r.get(y.modelId);if(K){const q={location:{x:K.geo.location.x,y:K.geo.location.y},size:{width:K.geo.size.width,height:K.geo.size.height}};return{entity:y,geo:q,collapsed:K.collapsed??!1,locked:K.locked??!1,groupRef:$,style:K.style,attributeStyles:K.attributeStyles,operationStyles:K.operationStyles}}const F=Pu(p++,i);return{entity:y,geo:F,collapsed:!1,locked:!1,groupRef:$}}),h=new Map(t.groupLayouts.map(y=>[y.groupRef,y])),b=e.groups.map(y=>{const $=h.get(y.modelId),K=$?{location:{x:$.geo.location.x,y:$.geo.location.y},size:{width:$.geo.size.width,height:$.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:y,geo:K,style:$==null?void 0:$.style,locked:($==null?void 0:$.locked)??!1}}),g=e.associations.map(y=>{const $=s.get(y.modelId);return{association:y,waypoints:($==null?void 0:$.waypoints)??[],sourceColumnRef:$==null?void 0:$.sourceColumnRef,targetColumnRef:$==null?void 0:$.targetColumnRef}}),_=t.notes.map(y=>({note:{...y,geo:{location:{x:y.geo.location.x,y:y.geo.location.y},size:{width:y.geo.size.width,height:y.geo.size.height}}},groupRef:f.get(y.modelId)})),N=[];for(const y of t.notes)for(const $ of y.connections??[])a.has($.targetRef)&&N.push({noteRef:y.modelId,targetRef:$.targetRef,waypoints:$.waypoints.map(K=>({x:K.x,y:K.y}))});return{entities:m,associations:g,groups:b,notes:_,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function Gn(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 wn=.5;function Fl(e,t,o,i,a,l){const r=Gn(t),s=Gn(a),c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:i.x+s.x*l,y:i.y+s.y*l},u=[c,...o,d],f=[];let p=e;const m=(g,_)=>{(Math.abs(g.x-p.x)>=wn||Math.abs(g.y-p.y)>=wn)&&(f.push({a:p,b:g,seg:_}),p=g)};m(c,0);let h=r.x!==0,b=c;for(let g=1;g<u.length;g++){const _=u[g],N=g<=o.length?g-1:o.length,y=Math.abs(_.x-b.x)<wn,$=Math.abs(_.y-b.y)<wn;y&&$||(y?(m(_,N),h=!1):$?(m(_,N),h=!0):h?(m({x:b.x,y:_.y},N),m(_,N),h=!0):(m({x:_.x,y:b.y},N),m(_,N),h=!1),b=_)}return m(i,o.length),f}function na(e,t,o,i,a,l=20){const r=Fl(e,t,o,i,a,l);let s=`M ${Je(e.x)},${Je(e.y)}`;for(const c of r)s+=` L ${Je(c.b.x)},${Je(c.b.y)}`;return s}const zu=14;function oa(e,t,o,i,a,l=20){return Fl(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=zu).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function Je(e){return Math.round(e*100)/100}const Uu=36;function Gl(e,t,o=Uu){const i=Math.max(e.x,t.x)+o;return`M ${Je(e.x)},${Je(e.y)} L ${Je(i)},${Je(e.y)} L ${Je(i)},${Je(t.y)} L ${Je(t.x)},${Je(t.y)}`}function ia(e,t,o){const i=[e,...t,o];let a=`M ${Je(i[0].x)},${Je(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${Je(i[l].x)},${Je(i[l].y)}`;return a}function Hu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function aa(e,t){const o=Hu(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<wn&&Math.abs(r)<wn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=l!==0?i/Math.abs(l):1/0,c=r!==0?a/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+l*d,y:o.y+r*d},f=s<=c?l>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function la(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function ra(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const Fu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Yl(e,t,o={}){const i={...Fu,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),l=[];let r=0;for(const u of e.groups){const f=a.get(u.modelId),p=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const h=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((b,g)=>{const _=g%h,N=Math.floor(g/h);l.push({id:b,location:{x:p.x+i.pad+_*i.cellWidth,y:p.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const p=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+m*i.cellHeight}})}),l}const Wl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Kl(e,t={}){const o={...Wl,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Gu(e,t={}){const o={...Wl,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=Kl(l.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:l.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Oo(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function ql(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 Xl(e){var l,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((l=c.name)==null?void 0:l.ko)??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(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,h)=>m.order-h.order);for(const m of f){if(m.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const h=m.dbAttrs[0],b=h!=null&&h.length?`(${h.length}${h.scale!=null?`,${h.scale}`:""})`:"",g=h?` → ${h.physicalName} ${h.dataType}${b}`:"",_=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",h!=null&&h.unique?"UNIQUE":"",h!=null&&h.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${m.name}: ${m.type}${g}${_.length?` {${_.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const h=m.columns.map(b=>`${o.get(b.columnRef)??b.columnRef}${b.descending?" DESC":""}`).join(", ");a.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${h}`)}const p=[...c.operations??[]].sort((m,h)=>m.order-h.order);for(const m of p){const h=m.visibility?` {${m.visibility}}`:"",b=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${h}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,f=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ql(c.end1.multiplicity)} —— ${ql(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
+ `).trim()}const Yu=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function at(e){return e.replace(Yu,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Re(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function jl(e){return`<text ${[`x="${Re(e.x)}"`,`y="${Re(e.y)}"`,`fill="${at(e.fill)}"`,`font-size="${Re(e.fontSize)}"`,e.fontFamily?`font-family="${at(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${at(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${at(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${at(e.text)}</text>`}function Wu(e){return`<line x1="${Re(e.x1)}" y1="${Re(e.y)}" x2="${Re(e.x2)}" y2="${Re(e.y)}" stroke="${at(e.stroke)}" stroke-width="${Re(e.strokeWidth??1)}" />`}function Ku(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 qu(e,t,o,i,a){return[`M${Re(e+a.tl)},${Re(t)}`,`L${Re(e+o-a.tr)},${Re(t)}`,a.tr?`Q${Re(e+o)},${Re(t)} ${Re(e+o)},${Re(t+a.tr)}`:"",`L${Re(e+o)},${Re(t+i-a.br)}`,a.br?`Q${Re(e+o)},${Re(t+i)} ${Re(e+o-a.br)},${Re(t+i)}`:"",`L${Re(e+a.bl)},${Re(t+i)}`,a.bl?`Q${Re(e)},${Re(t+i)} ${Re(e)},${Re(t+i-a.bl)}`:"",`L${Re(e)},${Re(t+a.tl)}`,a.tl?`Q${Re(e)},${Re(t)} ${Re(e+a.tl)},${Re(t)}`:"","Z"].filter(Boolean).join(" ")}function sa(e){const t=Ku(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${at(e.fill)}"`,`stroke="${at(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${at(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Re(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${qu(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Re(e.x)}" y="${Re(e.y)}" width="${Re(e.w)}" height="${Re(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Wu(r));for(const r of e.texts)l.push(jl(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Xu(e){const o=[`<path ${[`d="${at(e.d)}"`,'fill="none"',`stroke="${at(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${at(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(jl(i));return`<g>${o.join("")}</g>`}function Zl(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Re(t)}" y="${Re(o)}" width="${Re(i)}" height="${Re(a)}" fill="${at(e.background)}" />`);for(const r of e.groups)l.push(sa(r));for(const r of e.edges)l.push(Xu(r));for(const r of e.entities)l.push(sa(r));for(const r of e.notes)l.push(sa(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Re(t)} ${Re(o)} ${Re(i)} ${Re(a)}" width="${Re(i)}" height="${Re(a)}">`+l.join("")+"</svg>"}const ju=["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"],Zu=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"]),Ju=ju.filter(e=>!Zu.has(e)),Qu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ca(e){return Qu[e]??e}const ef=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Lo=new Set(["NUMERIC","DECIMAL"]);function Jl(e,t=Ju){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ot="CustomType",Yn="GroupCodeEnum",da="String",ua=[{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:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Yn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ot,label:"CustomType"}],tf=new Map(ua.map(e=>[e.value,e.label]));function vn(e){return tf.get(e)??e}const nf=new Set([Yn,"CustomMoneyType"]),Ql=ua.filter(e=>!nf.has(e.value)).map(e=>e.value===Ot?{...e,label:"CustomType (사용자정의)"}:e);function er(e,t=[]){const o=t.map(a=>{var r,s;const l=((r=a.label)==null?void 0:r.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:l?`${a.type} (${l})`:a.type}}),i=[...Ql,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:vn(e)},...i]:i}function of(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function tr(e,t){var a;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((a=i.jpa)==null?void 0:a.collectionType)??"LIST"}function fa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${vn(t.type)}>`:of(t)?vn(t.type):e==="CLASS"?t.type===Ot&&t.customType||vn(t.type):ca(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Wn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Po(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const ma=63;function zo(e){if(!e)return null;const t=e.length;return t<=ma?null:`물리명이 ${ma}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function nr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function ct(e){return!e||e.trim()===""}function Kn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function af(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=l.get(f)??o;if(p===o)d(f);else if(p===i){const m=r.slice(r.indexOf(f)),h=[...m].sort().join(" ");c.has(h)||(c.add(h),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function lf(e,t,o,i,a){var l,r,s,c,d;if(!ct(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(r=(l=a==null?void 0:a.embeddableCatalog)==null?void 0:l.find(u=>u.type===e.type))==null?void 0:r.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const f=(d=i.entities.find(p=>p.modelId===u))==null?void 0:d.attributes.flatMap(p=>p.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function pa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function or(e,t){var l,r,s;const o=[];for(const c of pa(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(h=>h.attrType!=="DIVIDER");if(ct(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),ct((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const h of d.filter(b=>b.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of d.filter(b=>b.identifier&&b.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of d)if(!h.identifier)for(const b of h.dbAttrs)!b.autoIncrement&&ct(b.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`채번(${b.autoIncrement?"auto increment":`시퀀스 "${b.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});for(const h of d.filter(b=>b.naturalId&&b.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${h.name}"`});for(const h of d.filter(b=>b.naturalId&&b.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of d.filter(b=>b.naturalId&&!b.notNull&&!b.identifier&&!b.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${h.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of pa(d,b=>b.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of d)ct(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),f=d.flatMap(h=>h.dbAttrs.map((b,g)=>({col:b,name:lf(h,b,g,e,t)})).filter(b=>b.col.sharedColumnRef==null));for(const h of pa(f,b=>b.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${h.name}"`});for(const h of u){const b=zo(h.physicalName);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:b}),t!=null&&t.reservedWords&&!ct(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!ct(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!ct(h.dataType)&&ef.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Wn(d.flatMap(b=>b.dbAttrs));for(const b of d){if(b.attrType!=="EMBED_PREDEF")continue;const g=t.embeddableCatalog.find(_=>_.type===b.type);g&&b.dbAttrs.forEach((_,N)=>{if(_.sharedColumnRef==null)return;const y=g.fields[N],$=h.get(_.sharedColumnRef);if(!y||!$)return;($.dataType!==y.dataType||($.length??null)!==(y.length??null)||($.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${nr($)})이 ${y.name??"컬럼"} 정의(${nr(y)})와 다릅니다`})})}}for(const h of d){const b=h.dbAttrs[0];if(!(b!=null&&b.multiValue))continue;h.type===Yn&&b.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${b.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const p=(s=c.table)==null?void 0:s.physicalName,m=zo(p);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!ct(p)&&t.reservedWords.has(p.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${p}"`});for(const h of c.indexes??[]){const b=zo(h.name);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:b}),t!=null&&t.reservedWords&&!ct(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){Kn(c.end1.multiplicity)&&Kn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],p=f.includes("ALL"),m=f.includes("REMOVE");p&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||p)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${p?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Kn(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&Kn(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Kn(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of af(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!ct(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Te(){return crypto.randomUUID()}const rf="CustomMoneyType",sf="Money";function cf(e){return!(e.type!==rf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function df(e){const t=e.dbAttrs[0]??{modelId:Te(),physicalName:"",dataType:""},o={modelId:Te(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:sf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function uf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>cf(r)?(a=!0,t=!0,df(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function ha(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function kn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>kn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!kn(e[i],t[i]))return!1;return!0}return!1}function Jt(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||kn(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function Qt(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),l=[],r=[],s=[];for(const[d,u]of a){const f=i.get(d);f?s.push({cur:f,tgt:u}):l.push(u)}for(const[d,u]of i)a.has(d)||r.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return l.sort(c),r.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:l,removed:r,common:s}}function ff(e,t){const o=new Set(e),i=new Set(t),a=t.filter(r=>!o.has(r)).sort(),l=e.filter(r=>!i.has(r)).sort();return{added:a,removed:l}}const mf=new Set(["attributes","operations","indexes","rev"]),pf=new Set(["end1","end2","rev"]),hf=new Set(["memberEntityRefs","rev"]),ir=new Set(["modelId"]),yf=new Set(["modelId","columns"]),gf=new Set([]);function bf(e,t,o,i){const a=Qt(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Jt(s,c,ir);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Qt(t.operations??[],o.operations??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of l.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){const d=Jt(s,c,ir);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Qt(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of r.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){if(!kn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Jt(s,c,yf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function _f(e,t,o){const i=Qt(e.entities??[],t.entities??[],r=>r.modelId);for(const r of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:r.modelId});for(const r of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:r.modelId,value:ha(r)});for(const{cur:r,tgt:s}of i.common){const c=Jt(r,s,mf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),bf(r.modelId,r,s,o)}const a=Qt(e.associations??[],t.associations??[],r=>r.modelId);for(const r of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:r.modelId});for(const r of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:r.modelId,value:ha(r)});for(const{cur:r,tgt:s}of a.common){const c=Jt(r,s,pf);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Jt(r[d]??{},s[d]??{},gf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Qt(e.groups??[],t.groups??[],r=>r.modelId);for(const r of l.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:r.modelId});for(const r of l.added)o.push({kind:"group.add",casUnit:"logical",groupRef:r.modelId,value:ha(r)});for(const{cur:r,tgt:s}of l.common){const c=Jt(r,s,hf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=ff(r.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u})}}function Uo(e,t,o,i,a,l,r){const s=Qt(e,t,o);for(const c of s.removed)r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0});for(const c of s.added)r.push({kind:i,casUnit:"layout",[l]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)kn(c,d)||(r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0}),r.push({kind:i,casUnit:"layout",[l]:o(d),value:d}))}function wf(e,t,o){Uo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Uo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Uo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Uo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function vf(e,t){const o=[];return _f(e.logical,t.logical,o),wf(e.layout,t.layout,o),o}function kf(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 Ef={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 Nf{constructor(t){Fe(this,"out",[]);Fe(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...qn(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...qn(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...qn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...qn(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...qn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function qn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function yt(e,t,o,i){if(o==null||typeof o!="object")return;const a=Ef[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function en(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ya(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Lt(e,t){var l,r,s,c,d,u,f,p;const o=kf(t),i=new Nf(t.field),a=[...e].sort((m,h)=>m.seq-h.seq);for(const m of a)for(const h of m.ops)switch(o){case"entity":if(h.entityRef!==t.entityRef)break;h.kind==="entity.add"?yt(i,m,h.value,"entity"):h.kind==="entity.update"?en(i,m,h.patch):h.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const b=ya((l=h.value)==null?void 0:l.attributes,t.attributeRef);b&&yt(i,m,b,"attribute")}else h.kind==="attribute.add"&&((r=h.value)==null?void 0:r.modelId)===t.attributeRef?yt(i,m,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===t.attributeRef?en(i,m,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===t.attributeRef||h.kind==="entity.remove")&&i.remove(m);break;case"operation":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const b=ya((s=h.value)==null?void 0:s.operations,t.operationRef);b&&yt(i,m,b,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===t.operationRef?yt(i,m,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===t.operationRef?en(i,m,h.patch):(h.kind==="operation.remove"&&h.operationRef===t.operationRef||h.kind==="entity.remove")&&i.remove(m);break;case"index":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const b=ya((d=h.value)==null?void 0:d.indexes,t.indexRef);b&&yt(i,m,b,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===t.indexRef?yt(i,m,h.value,"index"):h.kind==="index.update"&&h.indexRef===t.indexRef?en(i,m,h.patch):(h.kind==="index.remove"&&h.indexRef===t.indexRef||h.kind==="entity.remove")&&i.remove(m);break;case"association":if(h.associationRef!==t.associationRef)break;h.kind==="association.add"?yt(i,m,h.value,"association"):h.kind==="association.update"?en(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(h.associationRef!==t.associationRef)break;if(h.kind==="association.add"){const b=(f=h.value)==null?void 0:f[t.end];yt(i,m,b,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===t.end?en(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"group":if(h.groupRef!==t.groupRef)break;if(h.kind==="group.add"){yt(i,m,h.value,"group");const b=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(b))for(const g of b)i.member(m,g,!1)}else h.kind==="group.update"?en(i,m,h.patch):h.kind==="group.remove"?i.remove(m):h.kind==="group.addMember"&&h.entityRef!=null?i.member(m,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(m,h.entityRef,!0);break}return i.result()}function $f(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function En(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function xf(e,t){const o=new Set,i=new Set,a=new Set;for(const l of e)for(const r of l.ops){const s=r;if(r.kind==="entity.add"&&s.entityRef===t){const c=s.value;En(c==null?void 0:c.attributes,o),En(c==null?void 0:c.operations,i),En(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?En([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?En([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?En([s.value],a):(r.kind==="index.update"||r.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function Ho(e,t){return e.map(o=>({...o,subject:t}))}function ar(e,t){const o=e.filter(s=>s.ops.some(c=>$f(c,t))),{attributes:i,operations:a,indexes:l}=xf(o,t),r=[...Ho(Lt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Ho(Lt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Ho(Lt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Ho(Lt(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return r.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 lr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function If(e){var i,a,l;const t=new Set,o=(r,s)=>{typeof s=="string"&&t.add(`${r}:${s}:`)};for(const r of e)for(const s of r.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(l=c.value)==null?void 0:l.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function Sf(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const l of a.ops){const r=l,s=l.kind;if(s.startsWith("entity."))typeof r.entityRef=="string"&&t.add(r.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=r.containerRef??r.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof r.associationRef=="string"&&o.add(r.associationRef):s.startsWith("group.")&&typeof r.groupRef=="string"&&i.add(r.groupRef)}return{entities:t,associations:o,groups:i}}function Cf(e){const{entities:t,associations:o,groups:i}=Sf(e),a=[];for(const l of t)for(const r of ar(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Lt(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Lt(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Lt(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function rr(e){const t=Cf(e),o=If(e),i=new Map;for(const r of t){const s=lr(r.subject),c=i.get(s);(c===void 0||r.seq<c)&&i.set(s,r.seq)}const a=new Map;for(const r of t){let s=a.get(r.seq);s||(s={meta:r,subjects:new Map},a.set(r.seq,s));const c=lr(r.subject);let d=s.subjects.get(c);if(!d){const u=r.removed?"remove":i.get(c)===r.seq&&o.has(c)?"add":"update";d={subject:r.subject,verb:u,fields:[]},s.subjects.set(c,d)}r.removed?d.verb="remove":d.fields.push({field:r.field,value:r.value,...r.oldValue!==void 0?{oldValue:r.oldValue}:{}})}const l=[];for(const[r,s]of a){const c=s.meta;l.push({seq:r,...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 l.sort((r,s)=>s.seq-r.seq)}class ga{constructor(t){Fe(this,"undoStack",[]);Fe(this,"redoStack",[]);Fe(this,"savePoint",null);Fe(this,"listeners",new Set);Fe(this,"commandListeners",new Set);Fe(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function sr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Ke(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function dt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Pe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function xt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function ba(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=sr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Ke(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function _a(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=sr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Ke(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:l>=0?{item:i.layout.entityLayouts[l],index:l}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(p=>p.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}l>=0&&i.layout.entityLayouts.splice(l,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,l)=>a.index-l.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,l)=>a.index-l.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const l=i.logical.groups.find(r=>r.modelId===a.groupId);l==null||l.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const l of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:l.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:l.item.modelId,value:l.item});for(const l of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:l.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:l.item.associationRef,value:l.item,incidental:!0});for(const l of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function cr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Pe(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Pe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function dr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Pe(i,e);o=a.name,a.name=t},invert(i){Pe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Nn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Ke(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.location},l.location={...t}},invert(i){const a=Ke(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function ur(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Ke(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.size},l.size={...t}},invert(i){const a=Ke(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Xn(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function fr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Ke(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=Xn(l.style,t)},invert(i){const a=Ke(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Ke(i,e),l=a>=0?i.layout.entityLayouts[a].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(l)],invert:[r(o)]}}}}function mr(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Ke(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.collapsed,l.collapsed=t},invert(i){const a=Ke(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(t)],invert:[i(o)]}}}}function pr(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Ke(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.locked,l.locked=t},invert(i){const a=Ke(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function wa(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((l,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:a}}}}function Fo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Ke(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=Xn(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ke(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Ke(a,e),r=l>=0?a.layout.entityLayouts[l].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function va(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function hr(e,t){const o={},i=a=>{const l=a.logical.groups.find(r=>r.modelId===e);if(!l)throw new Error(`그룹 없음: ${e}`);return l};return{label:"그룹 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function ka(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function yr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function Go(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function gr(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function br(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function _r(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Xn(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e),l=r=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function wr(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function It(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Pe(o,e).attributes.push(t)},invert(o){const i=Pe(o,e),a=i.attributes.findIndex(l=>l.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function tn(e,t,o){const i={},a=l=>{const r=Pe(l,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function Pt(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Pe(i,e),l=a.attributes.findIndex(r=>r.modelId===t);if(l<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[l],index:l},a.attributes.splice(l,1)},invert(i){o&&Pe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Ea(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Pe(a,e);i=l.attributes.map(f=>({...f}));const r=new Set(t),s=l.attributes.filter(f=>r.has(f.modelId)),c=l.attributes.filter(f=>!r.has(f.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];l.attributes.splice(0,l.attributes.length,...u),l.attributes.forEach((f,p)=>f.order=p)},invert(a){i&&Pe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Pe(a,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function vr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Pe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Pe(i,e),l=((r=a.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;l>=0&&a.operations.splice(l,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function kr(e,t,o){const i={},a=l=>{var s;const r=(s=Pe(l,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Er(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Pe(i,e),l=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(l<0)throw new Error(`메서드 없음: ${t}`);const r=a.operations.length===1;o={item:a.operations[l],index:l,wasSole:r},a.operations.splice(l,1),r&&(a.operations=void 0)},invert(i){if(!o)return;const a=Pe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Nr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Pe(a,e),r=l.operations??[];i=r.map(p=>({...p}));const s=new Set(t),c=r.filter(p=>s.has(p.modelId)),d=r.filter(p=>!s.has(p.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((p,m)=>p.order=m),l.operations=r},invert(a){if(!i)return;const l=Pe(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Pe(a,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function $r(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Ke(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=Xn(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ke(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Ke(a,e),r=l>=0?a.layout.entityLayouts[l].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function Na(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function $a(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Yo(e,t){const o={},i=a=>{const l=a.logical.associations.find(r=>r.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l};return{label:"관계 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function $n(e,t,o){const i={},a=l=>{const r=l.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function xr(e,t){return{label:"인덱스 추가",apply(o){const i=Pe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Pe(o,e),a=((l=i.indexes)==null?void 0:l.findIndex(r=>r.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Ir(e,t,o){const i={},a=l=>{var s;const r=(s=Pe(l,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function Sr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Pe(i,e),l=((r=a.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(l<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[l],index:l},a.indexes.splice(l,1)},invert(i){o&&Pe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const gt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),jn=(e,t)=>{var o;return((o=dt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Cr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=dt(a,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...l.waypoints[t]},l.waypoints.splice(t,1,{...o})},invert(a){const l=dt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=jn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[gt(e,l)],invert:[gt(e,r)]}}}}function Rr(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=dt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=dt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=jn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[gt(e,a)],invert:[gt(e,l)]}}}}function Vr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=dt(a,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);i=l.waypoints.map(r=>({...r})),l.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(a){const l=dt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[gt(e,jn(a,e))],invert:[gt(e,i??[])]}}}}function Ar(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=dt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=dt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[gt(e,jn(o,e))],invert:[gt(e,t??[])]}}}}function Tr(e,t,o){return{label:"waypoint 추가",apply(i){const a=dt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=dt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=jn(i,e),l=a.slice();return l.splice(t,1),{forward:[gt(e,a)],invert:[gt(e,l)]}}}}function Mr(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function xa(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Zn(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Br(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Dr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Or(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Xn(a.style,t)},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(r=>r.modelId===e),l=r=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function Lr(e,t){let o=!1,i=!1;const a=l=>l.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(l){const r=a(l);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(l){if(!o)return;const r=a(l);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function Pr(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const zt=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Wo=(e,t,o)=>{var i;return((i=xt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function zr(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const l=a.layout.notes.find(r=>r.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);if(l.connections||(l.connections=[],i=!0),l.connections.some(r=>r.targetRef===t)){o=!1;return}l.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const l=a.layout.notes.find(s=>s.modelId===e);if(!(l!=null&&l.connections))return;const r=l.connections.findIndex(s=>s.targetRef===t);r>=0&&l.connections.splice(r,1),i&&delete l.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function Ur(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const a=i.layout.notes.find(s=>s.modelId===e),l=((r=a==null?void 0:a.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||l<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[l],index:l},a.connections.splice(l,1)},invert(i){if(!o)return;const a=i.layout.notes.find(l=>l.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function Hr(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=xt(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=xt(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Wo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[zt(e,t,r)],invert:[zt(e,t,s)]}}}}function Fr(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=xt(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=xt(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Wo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function Gr(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=xt(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=xt(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Wo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function Yr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=xt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=xt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[zt(e,t,Wo(i,e,t))],invert:[zt(e,t,o??[])]}}}}function ze(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(l=>{if(!l.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${l.label}`);return l.emitOps(i)});return{forward:a.flatMap(l=>l.forward),invert:a.slice().reverse().flatMap(l=>l.invert)}}}}const Rf=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Na,addAttribute:It,addEntity:ba,addEntityToGroup:yr,addGroup:va,addIndex:xr,addNote:Mr,addNoteConnection:zr,addNoteConnectionWaypoint:Fr,addNoteToGroup:Lr,addOperation:vr,addWaypoint:Tr,clearNoteConnectionWaypoints:Yr,clearWaypoints:Ar,composite:ze,moveEntity:Nn,moveGroup:gr,moveNote:Zn,moveNoteConnectionWaypoint:Hr,moveWaypoint:Cr,removeAssociation:$a,removeAttribute:Pt,removeEntity:_a,removeEntityFromGroup:Go,removeGroup:ka,removeIndex:Sr,removeNote:xa,removeNoteConnection:Ur,removeNoteConnectionWaypoint:Gr,removeNoteFromGroup:Pr,removeOperation:Er,removeWaypoint:Rr,renameEntity:dr,reorderAttributes:Ea,reorderOperations:Nr,resizeEntity:ur,resizeGroup:br,resizeNote:Br,setAllEntitiesCollapsed:wa,setAttributeSwatch:Fo,setEntityCollapsed:mr,setEntityLocked:pr,setEntitySwatch:fr,setGroupLocked:wr,setGroupSwatch:_r,setNoteMemo:Dr,setNoteSwatch:Or,setOperationSwatch:$r,translateWaypoints:Vr,updateAssociation:Yo,updateAssociationEnd:$n,updateAttribute:tn,updateEntity:cr,updateGroup:hr,updateIndex:Ir,updateOperation:kr},Symbol.toStringTag,{value:"Module"}));class Wr{constructor(){Fe(this,"revs",new Map);Fe(this,"layoutVersion",0);Fe(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class Kr{constructor(t){Fe(this,"cache",new Wr);Fe(this,"newClientOpId");Fe(this,"debounceMs");Fe(this,"emissions",new WeakMap);Fe(this,"open",null);Fe(this,"debounceHandle",null);Fe(this,"queue",[]);Fe(this,"sending",!1);Fe(this,"_frozen",!1);Fe(this,"stack",null);Fe(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Te,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,l)=>this.handle(i,a,l));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let a;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const l=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=l,this.emissions.set(t,{forward:l,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:l,inv:a.invert},this.startDebounce();return}l.length&&this.enqueue(this.buildBatch(l))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let a=!1,l=!1;for(const r of t)if(r.casUnit==="logical")if(a=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(l=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return l&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(l){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",l),(a=(i=this.opts).onError)==null||a.call(i,l),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const qr=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"],Xr=()=>crypto.randomUUID(),Vf=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Af=e=>e&&e[0].toLowerCase()+e.slice(1),Tf=e=>e&&e[0].toUpperCase()+e.slice(1),Mf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Bf(e,t){return Af(e)+Tf(t)}function Df(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=Bf(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:a,notNull:a,dbAttrs:r.dbAttrs.map(c=>({physicalName:Mf(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Ko=(e,t)=>`${e}::${t}`,qo=e=>e??void 0;function Of(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||qo(s.length)!==qo(l.length)||qo(s.scale)!==qo(l.scale)}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function Lf(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Jn(e,t,o=Xr){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===t);if(!a)return i;const l=e.associations.filter(f=>f.end2.entityRef===t),r=a.stereotype==="JPA_EMBEDDABLE"?[]:l.flatMap(f=>Df(e,f)),s=new Map(r.map(f=>[Ko(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Ko(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=Ko(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,p)=>Math.max(f,p.order),-1)+1;for(const f of r){const p=Ko(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(Lf(f,u++,o));else{const h=Of(m,f,o);h&&i.update.push({attributeId:m.modelId,patch:h})}}return i}function Pf(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function zf(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function Uf(e,t,o=Xr){const i=new Map,a=zf(e),l=new Set,r=[t];for(;r.length;){const s=r.shift();if(l.has(s))continue;l.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=Jn(a,d,o);if(Vf(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(p=>p.modelId===d);f&&Pf(f,u),l.has(d)||r.push(d)}}return i}function Hf(e,t){const o=()=>e.entities.filter(l=>{var r;return((r=l.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(l=>l.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function Ff(e,t){const o=()=>e.attributes.filter(l=>l.name===t.ref),i=()=>e.attributes.filter(l=>l.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function jr(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function tt(e,t){const o=Hf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Gf(e,t){const o=Ff(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Yf(e,t){const o=()=>e.attributes.flatMap(l=>l.dbAttrs).filter(l=>l.physicalName===t.ref),i=()=>e.attributes.filter(l=>l.name===t.ref).flatMap(l=>l.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function Zr(e,t){const o=Yf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Wf(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Kf(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function qf(e,t){const o=Wf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Xf(e,t){const o=Kf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Jr(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Qr(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),u=[];let f=!1;for(const p of t.fields){const m=d.get(p.name);if(m!=null&&m.sharedColumnPhysicalName){const h={ref:m.sharedColumnPhysicalName,by:"physicalName"},b=Zr(i,h);if(!b.ok){r.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:h}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:h,matches:b.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:u}}function es(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function ts(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=Zr(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}r.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:l(),name:t.name,unique:t.unique??!1,columns:r,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function jf(e,t,o={}){const i=o.mkId??Te,a=o.embeddableCatalog??[],l=f=>a.find(p=>p.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,p)=>{var m,h,b;switch(f.kind){case"entity.add":{const g=i(),_={modelId:g,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},N={ref:f.spec.name};let y=!1;for(const[F,q]of(f.spec.attributes??[]).entries()){if(q.type==="GroupCodeEnum"&&!q.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:N,handle:{ref:q.name}}),y=!0;continue}const G=l(q.type);if(G){const X=Qr(q,G,F,_,p,N,s,i);X?_.attributes.push(X):y=!0}else(m=q.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:p,entity:N,handle:{ref:q.name}}),y=!0):_.attributes.push(Jr(q,F,i))}const $=(f.spec.operations??[]).map((F,q)=>es(F,q,i));$.length&&(_.operations=$);const K=[];for(const F of f.spec.indexes??[]){const q=ts(_,F,p,N,s,i);q?K.push(q):y=!0}if(K.length&&(_.indexes=K),y)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:g,value:_});break}case"entity.update":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,patch:f.patch});break}case"entity.remove":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:g.value.modelId});break}case"attribute.add":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(g.value.modelId)??g.value.attributes.length;c.set(g.value.modelId,_+1);const N=l(f.spec.type);let y;if(N)y=Qr(f.spec,N,_,g.value,p,f.entity,s,i);else if((h=f.spec.embeddableOverrides)!=null&&h.length){s.push({code:"embeddable-type-unresolved",opIndex:p,entity:f.entity,handle:{ref:f.spec.name}});break}else y=Jr(f.spec,_,i);if(!y)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,value:y});break}case"attribute.update":case"attribute.remove":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}const _=Gf(g.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:p,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:p,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const g=tt(e,f.spec.from),_=tt(e,f.spec.to);if(g.ok||s.push(nt(g.reason,p,f.spec.from,g.matches,u)),_.ok||s.push(nt(_.reason,p,f.spec.to,_.matches,u)),!g.ok||!_.ok)break;if(f.spec.identifying&&g.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:p,handle:{from:f.spec.from,to:f.spec.to}});break}const N=i(),y={modelId:N,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:g.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},$={...e,associations:[...e.associations,y]},K=Jn($,_.value.modelId,i);K.add[0]&&(y.end2.attributeRef=K.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:N,value:y});for(const F of K.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:F});break}case"association.remove":{const g=tt(e,f.association.from),_=tt(e,f.association.to);if(g.ok||s.push(nt(g.reason,p,f.association.from,g.matches,u)),_.ok||s.push(nt(_.reason,p,f.association.to,_.matches,u)),!g.ok||!_.ok)break;const N=jr(e,g.value.modelId,_.value.modelId);if(N.length!==1){s.push(N.length===0?{code:"association-not-found",opIndex:p,handle:f.association}:{code:"association-ambiguous",opIndex:p,handle:f.association,matches:N.map(y=>y.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:N[0].modelId});break}case"association.update":{const g=ns(e,f.association,p,s,u);if(!g)break;r.push({kind:"association.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,patch:f.patch});break}case"associationEnd.update":{const g=ns(e,f.association,p,s,u);if(!g)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,end:_,patch:f.patch});break}case"index.add":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}const _=ts(g.value,f.spec,p,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}const _=qf(g.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:p,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:p,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:p,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}const _=d.get(g.value.modelId)??((b=g.value.operations)==null?void 0:b.length)??0;d.set(g.value.modelId,_+1);const N=es(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const g=tt(e,f.entity);if(!g.ok){s.push(nt(g.reason,p,f.entity,g.matches,u));break}const _=Xf(g.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:p,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:p,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const g=[];let _=!1;for(const $ of f.spec.members){const K=tt(e,$);if(!K.ok){s.push(nt(K.reason,p,$,K.matches,u)),_=!0;continue}g.push(K.value.modelId)}if(_)break;const N=i(),y={modelId:N,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:g,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:N,value:y});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function nt(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function ns(e,t,o,i,a){const l=tt(e,t.from),r=tt(e,t.to);if(l.ok||i.push(nt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(nt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=jr(e,l.value.modelId,r.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const os={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Zf={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Jf={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},Xo={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Qf={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:{...Xo,description:"속성 설명(다국어)."},columnLogicalName:{...Xo,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(type이 카탈로그 엔트리일 때만). field=카탈로그 필드명으로 매칭 (@AttributeOverride 대응). 미설정 서브컬럼은 카탈로그 기본 상속. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}}},required:["name","type"],additionalProperties:!1},is={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},em={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...is,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...is,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},tm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...os,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},nm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Xo,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},om={type:"object",properties:{name:{...Xo,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},im={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function Ze(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const am={"entity.add":Ze("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":Ze("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":Ze("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":Ze("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":Ze("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":Ze("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":Ze("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":Ze("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":Ze("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":Ze("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":Ze("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":Ze("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":Ze("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":Ze("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":Ze("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":Ze("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":Ze("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},as={anyOf:qr.map(e=>am[e])},lm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:os,assocHandle:Zf,entitySpec:Jf,attrSpec:Qf,assocSpec:em,indexSpec:tm,operationSpec:nm,groupSpec:om,patch:im,symbolicOp:as}};function rm(e,t,o,i={}){const a=i.mkClientOpId??Te,l=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&l.add(s.containerRef);const r={};if(l.size){r.revs={};for(const s of l)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:a()}}const ls={location:{x:0,y:0},size:{width:220,height:140}};function rs(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const sm=/^[-=_*~\s]{3,}$/;function cm(e){return e.attrType&&e.attrType!=="NORMAL"||!sm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function dm(e,t){return e.attrType==="DIVIDER"||cm(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{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??t,dbAttrs:e.dbAttrs.map(rs)}}function um(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:l,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:l?{ko:l}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function fm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function mm(e){var t,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(dm),operations:(t=e.operations)==null?void 0:t.map(um),indexes:(o=e.indexes)==null?void 0:o.map(fm),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function pm(e){const t={};for(const i of e.attributes)i.style&&(t[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...ls},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function ss(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 Ia(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:ss(e)}}function hm(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ia(e.end1),end2:Ia(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:t,layout:o}}function cs(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ds(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function us(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function fs(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(rs)}}function ym(e,t,o){var g,_;const i=cs(e.end1.attribute),a=cs(e.end2.attribute);if(i===a)return hm(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(g=s.dbAttrs)==null?void 0:g[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((N,y)=>Math.max(N,y.order),-1)+1:s.order??0,p={...fs(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=(N,y)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:y?d:p.modelId,legacyNavRaw:y?void 0:N.attribute,jpa:ss(N)}),h={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h.end1.attributeRef,targetColumnRef:h.end2.attributeRef,style:e.style};return{assoc:h,layout:b}}function gm(e,t){const o=e.targetModelId?t.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function bm(e,t,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((b,g)=>Math.max(b,g.order),-1)+1:r.order??0,d={...fs(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>gm(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...Ia(b),legacyEmbedRaw:b.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function _m(e,t){var i,a,l,r;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(r=(l=s.end2)==null?void 0:l.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function ms(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:l,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=_m(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:l,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function wm(e){return(e.schemaVersion??1)>=2&&"logical"in e?vm(e):km(e)}function vm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function km(e){var _,N;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,$)=>{o.push(mm(y));const K=pm(y);K.geo={location:{x:K.geo.location.x+$.x,y:K.geo.location.y+$.y},size:K.geo.size},i.push(K);for(const F of y.ownedAssociations??[])c.push(F)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const $=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:$.map(F=>F.modelId)});const K=((_=y.geo)==null?void 0:_.location)??u;if(y.geo){const F=(y.notes??[]).map(q=>q.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,locked:y.locked,memberNoteRefs:F.length?F:void 0})}for(const F of $)d(F,K);for(const F of y.notes??[])f.push(ms(F,K))}const p=new Map(o.map(y=>[y.modelId,y])),m=new Map,h=new Map;for(const y of o)for(const $ of y.attributes)for(const K of $.dbAttrs)m.set(K.modelId,$.modelId),h.set(K.modelId,K);for(const y of c)for(const $ of[y.end1,y.end2]){const K=$.attribute;if(K&&(((N=K.dbAttrs)==null?void 0:N.length)??0)>0)for(const F of K.dbAttrs)F.modelId&&m.set(F.modelId,K.modelId)}for(const y of c){const $=ds(y.end1.attribute),K=ds(y.end2.attribute),F=us(y.end1)||us(y.end2),{assoc:q,layout:G}=$!==K||F?bm(y,p,h):ym(y,p,m);a.push(q),l.push(G)}const b={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>ms(y)),...f]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function ps(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Em(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(ps),style:t}}function Nm(e,t){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:t}}function $m(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Ut(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function xm(e,t){const o=t==null?void 0:t.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var l;return{...ps(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function Im(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function Sm(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function Cm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function Rm(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:Cm(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function Vm(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var h;return((h=m.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.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((f,p)=>Rm(f,r[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:Ut(e.end1,c?s:u),end2:Ut(e.end2,c?u:s)}}function Am(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:Ut(e.end1,e.end1.legacyEmbedRaw),end2:Ut(e.end2,e.end2.legacyEmbedRaw)};const a=Vm(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(h=>h.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(h=>h.modelId===s.attributeRef),f=t.logical.entities.find(h=>h.modelId===c.entityRef),p=u?xm(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ut(e.end1,l?m:p),end2:Ut(e.end2,r?m:p)}}return{...i,end1:Ut(e.end1),end2:Ut(e.end2)}}function hs(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(p=>p.entityRef===e.modelId),r=t.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>t.layout.associationLayouts.find(m=>m.associationRef===p),c=(l==null?void 0:l.geo)??{...ls},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 m;return Em(p,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var m;return Nm(p,(m=l==null?void 0:l.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>Am(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map($m),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed,locked:l==null?void 0:l.locked}}function Tm(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),l=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>ys(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>hs(c,t,o,i,r)),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 ys(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function Mm(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Im(e),l=Sm(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>hs(s,e,a,l)),groups:e.logical.groups.map(s=>Tm(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>ys(s))}}function Bm(e,t={}){var a,l,r;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((l=t.revSeed)==null?void 0:l.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:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function Qn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function St(e){return typeof e=="function"?e():n.unref(e)}const Dm=typeof window<"u"&&typeof document<"u",Om=e=>typeof e<"u",Lm=Object.prototype.toString,Pm=e=>Lm.call(e)==="[object Object]",zm=()=>{};function Um(e,t){function o(...i){return new Promise((a,l)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(l)})}return o}const gs=e=>e();function Hm(e=gs){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...l)=>{t.value&&e(...l)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function bs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Fm(e,t,o={}){const{eventFilter:i=gs,...a}=o;return n.watch(e,Um(i,t),a)}function xn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=Hm(i);return{stop:Fm(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Gm(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var l;if((l=St(t.replaceRef))!=null?l:!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 Sa(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:h,throwOnTimeout:b}={}){let g=null;const N=[new Promise(y=>{g=n.watch(e,$=>{f($)!==t&&(g==null||g(),y($))},{flush:p,deep:m,immediate:!0})})];return h!=null&&N.push(bs(h,b).then(()=>St(e)).finally(()=>g==null?void 0:g())),Promise.race(N)}function i(f,p){if(!n.isRef(f))return o($=>$===f,p);const{flush:m="sync",deep:h=!1,timeout:b,throwOnTimeout:g}=p??{};let _=null;const y=[new Promise($=>{_=n.watch([e,f],([K,F])=>{t!==(K===F)&&(_==null||_(),$(K))},{flush:m,deep:h,immediate:!0})})];return b!=null&&y.push(bs(b,g).then(()=>St(e)).finally(()=>(_==null||_(),St(e)))),Promise.race(y)}function a(f){return o(p=>!!p,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,p){return o(m=>{const h=Array.from(m);return h.includes(f)||h.includes(St(f))},p)}function d(f){return u(1,f)}function u(f=1,p){let m=-1;return o(()=>(m+=1,m>=f),p)}return Array.isArray(St(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Sa(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Sa(e,!t)}}}function Ca(e){return Sa(e)}function Ym(e){var t;const o=St(e);return(t=o==null?void 0:o.$el)!=null?t:o}const _s=Dm?window:void 0;function ws(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=_s):[t,o,i,a]=e,!t)return zm;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,p,m)=>(u.addEventListener(f,p,m),()=>u.removeEventListener(f,p,m)),c=n.watch(()=>[Ym(t),St(a)],([u,f])=>{if(r(),!u)return;const p=Pm(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(h=>s(u,m,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Qn(d),d}function Wm(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function vs(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=_s,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Wm(t);return ws(a,l,u=>{u.repeat&&St(s)||c(u)&&o(u)},r)}function Km(e){return JSON.parse(JSON.stringify(e))}function Ra(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),h=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let b=d;t||(t="modelValue"),b=b||`update:${t.toString()}`;const g=y=>s?typeof s=="function"?s(y):Km(y):y,_=()=>Om(e[t])?g(e[t]):f,N=y=>{p?p(y)&&h(b,y):h(b,y)};if(c){const y=_(),$=n.ref(y);let K=!1;return n.watch(()=>e[t],F=>{K||(K=!0,$.value=g(F),n.nextTick(()=>K=!1))}),n.watch($,F=>{!K&&(F!==e[t]||u)&&N(F)},{deep:u}),$}else return n.computed({get(){return _()},set(y){N(y)}})}var qm={value:()=>{}};function jo(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Zo(o)}function Zo(e){this._=e}function Xm(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Zo.prototype=jo.prototype={constructor:Zo,on:function(e,t){var o=this._,i=Xm(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=jm(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=ks(o[a],e.name,t);else if(t==null)for(a in o)o[a]=ks(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Zo(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function jm(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function ks(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=qm,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Va="http://www.w3.org/1999/xhtml";const Es={svg:"http://www.w3.org/2000/svg",xhtml:Va,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jo(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Es.hasOwnProperty(t)?{space:Es[t],local:e}:e}function Zm(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Va&&t.documentElement.namespaceURI===Va?t.createElement(e):t.createElementNS(o,e)}}function Jm(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ns(e){var t=Jo(e);return(t.local?Jm:Zm)(t)}function Qm(){}function Aa(e){return e==null?Qm:function(){return this.querySelector(e)}}function ep(e){typeof e!="function"&&(e=Aa(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new lt(i,this._parents)}function tp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function np(){return[]}function $s(e){return e==null?np:function(){return this.querySelectorAll(e)}}function op(e){return function(){return tp(e.apply(this,arguments))}}function ip(e){typeof e=="function"?e=op(e):e=$s(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new lt(i,a)}function xs(e){return function(){return this.matches(e)}}function Is(e){return function(t){return t.matches(e)}}var ap=Array.prototype.find;function lp(e){return function(){return ap.call(this.children,e)}}function rp(){return this.firstElementChild}function sp(e){return this.select(e==null?rp:lp(typeof e=="function"?e:Is(e)))}var cp=Array.prototype.filter;function dp(){return Array.from(this.children)}function up(e){return function(){return cp.call(this.children,e)}}function fp(e){return this.selectAll(e==null?dp:up(typeof e=="function"?e:Is(e)))}function mp(e){typeof e!="function"&&(e=xs(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new lt(i,this._parents)}function Ss(e){return new Array(e.length)}function pp(){return new lt(this._enter||this._groups.map(Ss),this._parents)}function Qo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qo.prototype={constructor:Qo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function hp(e){return function(){return e}}function yp(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Qo(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function gp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Qo(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function bp(e){return e.__data__}function _p(e,t){if(!arguments.length)return Array.from(this,bp);var o=t?gp:yp,i=this._parents,a=this._groups;typeof e!="function"&&(e=hp(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],p=f.length,m=wp(e.call(u,u&&u.__data__,d,i)),h=m.length,b=s[d]=new Array(h),g=r[d]=new Array(h),_=c[d]=new Array(p);o(u,f,b,g,_,m,t);for(var N=0,y=0,$,K;N<h;++N)if($=b[N]){for(N>=y&&(y=N+1);!(K=g[y])&&++y<h;);$._next=K||null}}return r=new lt(r,i),r._enter=s,r._exit=c,r}function wp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vp(){return new lt(this._exit||this._groups.map(Ss),this._parents)}function kp(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function Ep(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new lt(s,this._parents)}function Np(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function $p(e){e||(e=xp);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new lt(a,this._parents).order()}function xp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ip(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sp(){return Array.from(this)}function Cp(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function Rp(){let e=0;for(const t of this)++e;return e}function Vp(){return!this.node()}function Ap(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function Tp(e){return function(){this.removeAttribute(e)}}function Mp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bp(e,t){return function(){this.setAttribute(e,t)}}function Dp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Op(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Lp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Pp(e,t){var o=Jo(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Mp:Tp:typeof t=="function"?o.local?Lp:Op:o.local?Dp:Bp)(o,t))}function Cs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zp(e){return function(){this.style.removeProperty(e)}}function Up(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Hp(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Fp(e,t,o){return arguments.length>1?this.each((t==null?zp:typeof t=="function"?Hp:Up)(e,t,o??"")):In(this.node(),e)}function In(e,t){return e.style.getPropertyValue(t)||Cs(e).getComputedStyle(e,null).getPropertyValue(t)}function Gp(e){return function(){delete this[e]}}function Yp(e,t){return function(){this[e]=t}}function Wp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Kp(e,t){return arguments.length>1?this.each((t==null?Gp:typeof t=="function"?Wp:Yp)(e,t)):this.node()[e]}function Rs(e){return e.trim().split(/^|\s+/)}function Ta(e){return e.classList||new Vs(e)}function Vs(e){this._node=e,this._names=Rs(e.getAttribute("class")||"")}Vs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function As(e,t){for(var o=Ta(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Ts(e,t){for(var o=Ta(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function qp(e){return function(){As(this,e)}}function Xp(e){return function(){Ts(this,e)}}function jp(e,t){return function(){(t.apply(this,arguments)?As:Ts)(this,e)}}function Zp(e,t){var o=Rs(e+"");if(arguments.length<2){for(var i=Ta(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?jp:t?qp:Xp)(o,t))}function Jp(){this.textContent=""}function Qp(e){return function(){this.textContent=e}}function eh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function th(e){return arguments.length?this.each(e==null?Jp:(typeof e=="function"?eh:Qp)(e)):this.node().textContent}function nh(){this.innerHTML=""}function oh(e){return function(){this.innerHTML=e}}function ih(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ah(e){return arguments.length?this.each(e==null?nh:(typeof e=="function"?ih:oh)(e)):this.node().innerHTML}function lh(){this.nextSibling&&this.parentNode.appendChild(this)}function rh(){return this.each(lh)}function sh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ch(){return this.each(sh)}function dh(e){var t=typeof e=="function"?e:Ns(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function uh(){return null}function fh(e,t){var o=typeof e=="function"?e:Ns(e),i=t==null?uh:typeof t=="function"?t:Aa(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function mh(){var e=this.parentNode;e&&e.removeChild(this)}function ph(){return this.each(mh)}function hh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gh(e){return this.select(e?yh:hh)}function bh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function _h(e){return function(t){e.call(this,t,this.__data__)}}function wh(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function vh(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function kh(e,t,o){return function(){var i=this.__on,a,l=_h(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function Eh(e,t,o){var i=wh(e+""),a,l=i.length,r;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<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?kh:vh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Ms(e,t,o){var i=Cs(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Nh(e,t){return function(){return Ms(this,e,t)}}function $h(e,t){return function(){return Ms(this,e,t.apply(this,arguments))}}function xh(e,t){return this.each((typeof t=="function"?$h:Nh)(e,t))}function*Ih(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var Bs=[null];function lt(e,t){this._groups=e,this._parents=t}function eo(){return new lt([[document.documentElement]],Bs)}function Sh(){return this}lt.prototype=eo.prototype={constructor:lt,select:ep,selectAll:ip,selectChild:sp,selectChildren:fp,filter:mp,data:_p,enter:pp,exit:vp,join:kp,merge:Ep,selection:Sh,order:Np,sort:$p,call:Ip,nodes:Sp,node:Cp,size:Rp,empty:Vp,each:Ap,attr:Pp,style:Fp,property:Kp,classed:Zp,text:th,html:ah,raise:rh,lower:ch,append:dh,insert:fh,remove:ph,clone:gh,datum:bh,on:Eh,dispatch:xh,[Symbol.iterator]:Ih};function ut(e){return typeof e=="string"?new lt([[document.querySelector(e)]],[document.documentElement]):new lt([[e]],Bs)}function Ch(e){let t;for(;t=e.sourceEvent;)e=t;return e}function bt(e,t){if(e=Ch(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Rh={passive:!1},to={capture:!0,passive:!1};function Ma(e){e.stopImmediatePropagation()}function Sn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ds(e){var t=e.document.documentElement,o=ut(e).on("dragstart.drag",Sn,to);"onselectstart"in t?o.on("selectstart.drag",Sn,to):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Os(e,t){var o=e.document.documentElement,i=ut(e).on("dragstart.drag",null);t&&(i.on("click.drag",Sn,to),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 ei=e=>()=>e;function Ba(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:l,x:r,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:r,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}})}Ba.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Vh(e){return!e.ctrlKey&&!e.button}function Ah(){return this.parentNode}function Th(e,t){return t??{x:e.x,y:e.y}}function Mh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bh(){var e=Vh,t=Ah,o=Th,i=Mh,a={},l=jo("start","drag","end"),r=0,s,c,d,u,f=0;function p($){$.on("mousedown.drag",m).filter(i).on("touchstart.drag",g).on("touchmove.drag",_,Rh).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m($,K){if(!(u||!e.call(this,$,K))){var F=y(this,t.call(this,$,K),$,K,"mouse");F&&(ut($.view).on("mousemove.drag",h,to).on("mouseup.drag",b,to),Ds($.view),Ma($),d=!1,s=$.clientX,c=$.clientY,F("start",$))}}function h($){if(Sn($),!d){var K=$.clientX-s,F=$.clientY-c;d=K*K+F*F>f}a.mouse("drag",$)}function b($){ut($.view).on("mousemove.drag mouseup.drag",null),Os($.view,d),Sn($),a.mouse("end",$)}function g($,K){if(e.call(this,$,K)){var F=$.changedTouches,q=t.call(this,$,K),G=F.length,X,Q;for(X=0;X<G;++X)(Q=y(this,q,$,K,F[X].identifier,F[X]))&&(Ma($),Q("start",$,F[X]))}}function _($){var K=$.changedTouches,F=K.length,q,G;for(q=0;q<F;++q)(G=a[K[q].identifier])&&(Sn($),G("drag",$,K[q]))}function N($){var K=$.changedTouches,F=K.length,q,G;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),q=0;q<F;++q)(G=a[K[q].identifier])&&(Ma($),G("end",$,K[q]))}function y($,K,F,q,G,X){var Q=l.copy(),de=bt(X||F,K),B,ee,v;if((v=o.call($,new Ba("beforestart",{sourceEvent:F,target:p,identifier:G,active:r,x:de[0],y:de[1],dx:0,dy:0,dispatch:Q}),q))!=null)return B=v.x-de[0]||0,ee=v.y-de[1]||0,function R(E,P,W){var oe=de,T;switch(E){case"start":a[G]=R,T=r++;break;case"end":delete a[G],--r;case"drag":de=bt(W||P,K),T=r;break}Q.call(E,$,new Ba(E,{sourceEvent:P,subject:v,target:p,identifier:G,active:T,x:de[0]+B,y:de[1]+ee,dx:de[0]-oe[0],dy:de[1]-oe[1],dispatch:Q}),q)}}return p.filter=function($){return arguments.length?(e=typeof $=="function"?$:ei(!!$),p):e},p.container=function($){return arguments.length?(t=typeof $=="function"?$:ei($),p):t},p.subject=function($){return arguments.length?(o=typeof $=="function"?$:ei($),p):o},p.touchable=function($){return arguments.length?(i=typeof $=="function"?$:ei(!!$),p):i},p.on=function(){var $=l.on.apply(l,arguments);return $===l?p:$},p.clickDistance=function($){return arguments.length?(f=($=+$)*$,p):Math.sqrt(f)},p}function Da(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Ls(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function no(){}var oo=.7,ti=1/oo,Cn="\\s*([+-]?\\d+)\\s*",io="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dh=/^#([0-9a-f]{3,8})$/,Oh=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),Lh=new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`),Ph=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${io}\\)$`),zh=new RegExp(`^rgba\\(${_t},${_t},${_t},${io}\\)$`),Uh=new RegExp(`^hsl\\(${io},${_t},${_t}\\)$`),Hh=new RegExp(`^hsla\\(${io},${_t},${_t},${io}\\)$`),Ps={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};Da(no,nn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zs,formatHex:zs,formatHex8:Fh,formatHsl:Gh,formatRgb:Us,toString:Us});function zs(){return this.rgb().formatHex()}function Fh(){return this.rgb().formatHex8()}function Gh(){return Ws(this).formatHsl()}function Us(){return this.rgb().formatRgb()}function nn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Dh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Hs(t):o===3?new ot(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ni(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ni(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Oh.exec(e))?new ot(t[1],t[2],t[3],1):(t=Lh.exec(e))?new ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ph.exec(e))?ni(t[1],t[2],t[3],t[4]):(t=zh.exec(e))?ni(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Uh.exec(e))?Ys(t[1],t[2]/100,t[3]/100,1):(t=Hh.exec(e))?Ys(t[1],t[2]/100,t[3]/100,t[4]):Ps.hasOwnProperty(e)?Hs(Ps[e]):e==="transparent"?new ot(NaN,NaN,NaN,0):null}function Hs(e){return new ot(e>>16&255,e>>8&255,e&255,1)}function ni(e,t,o,i){return i<=0&&(e=t=o=NaN),new ot(e,t,o,i)}function Yh(e){return e instanceof no||(e=nn(e)),e?(e=e.rgb(),new ot(e.r,e.g,e.b,e.opacity)):new ot}function Oa(e,t,o,i){return arguments.length===1?Yh(e):new ot(e,t,o,i??1)}function ot(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Da(ot,Oa,Ls(no,{brighter(e){return e=e==null?ti:Math.pow(ti,e),new ot(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new ot(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ot(on(this.r),on(this.g),on(this.b),oi(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:Fs,formatHex:Fs,formatHex8:Wh,formatRgb:Gs,toString:Gs}));function Fs(){return`#${an(this.r)}${an(this.g)}${an(this.b)}`}function Wh(){return`#${an(this.r)}${an(this.g)}${an(this.b)}${an((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gs(){const e=oi(this.opacity);return`${e===1?"rgb(":"rgba("}${on(this.r)}, ${on(this.g)}, ${on(this.b)}${e===1?")":`, ${e})`}`}function oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function on(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function an(e){return e=on(e),(e<16?"0":"")+e.toString(16)}function Ys(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,o,i)}function Ws(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof no||(e=nn(e)),!e)return new ft;if(e instanceof ft)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new ft(r,s,c,e.opacity)}function Kh(e,t,o,i){return arguments.length===1?Ws(e):new ft(e,t,o,i??1)}function ft(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Da(ft,Kh,Ls(no,{brighter(e){return e=e==null?ti:Math.pow(ti,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new ft(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ot(La(e>=240?e-240:e+120,a,i),La(e,a,i),La(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ft(Ks(this.h),ii(this.s),ii(this.l),oi(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=oi(this.opacity);return`${e===1?"hsl(":"hsla("}${Ks(this.h)}, ${ii(this.s)*100}%, ${ii(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ks(e){return e=(e||0)%360,e<0?e+360:e}function ii(e){return Math.max(0,Math.min(1,e||0))}function La(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Pa=e=>()=>e;function qh(e,t){return function(o){return e+o*t}}function Xh(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function jh(e){return(e=+e)==1?qs:function(t,o){return o-t?Xh(t,o,e):Pa(isNaN(t)?o:t)}}function qs(e,t){var o=t-e;return o?qh(e,o):Pa(isNaN(e)?t:e)}const ai=(function e(t){var o=jh(t);function i(a,l){var r=o((a=Oa(a)).r,(l=Oa(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=qs(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Zh(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(l){for(a=0;a<o;++a)i[a]=e[a]*(1-l)+t[a]*l;return i}}function Jh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Qh(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),l=new Array(o),r;for(r=0;r<i;++r)a[r]=ao(e[r],t[r]);for(;r<o;++r)l[r]=t[r];return function(s){for(r=0;r<i;++r)l[r]=a[r](s);return l}}function ey(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function wt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function ty(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=ao(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var za=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ua=new RegExp(za.source,"g");function ny(e){return function(){return e}}function oy(e){return function(t){return e(t)+""}}function Xs(e,t){var o=za.lastIndex=Ua.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=za.exec(e))&&(a=Ua.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:wt(i,a)})),o=Ua.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?oy(c[0].x):ny(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}function ao(e,t){var o=typeof t,i;return t==null||o==="boolean"?Pa(t):(o==="number"?wt:o==="string"?(i=nn(t))?(t=i,ai):Xs:t instanceof nn?ai:t instanceof Date?ey:Jh(t)?Zh:Array.isArray(t)?Qh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ty:wt)(e,t)}var js=180/Math.PI,Ha={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zs(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*js,skewX:Math.atan(c)*js,scaleX:r,scaleY:s}}var li;function iy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ha:Zs(t.a,t.b,t.c,t.d,t.e,t.f)}function ay(e){return e==null||(li||(li=document.createElementNS("http://www.w3.org/2000/svg","g")),li.setAttribute("transform",e),!(e=li.transform.baseVal.consolidate()))?Ha:(e=e.matrix,Zs(e.a,e.b,e.c,e.d,e.e,e.f))}function Js(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var b=m.push("translate(",null,t,null,o);h.push({i:b-4,x:wt(d,f)},{i:b-2,x:wt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(a(f)+"rotate(",null,i)-2,x:wt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(a(f)+"skewX(",null,i)-2,x:wt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var b=m.push(a(m)+"scale(",null,",",null,")");h.push({i:b-4,x:wt(d,f)},{i:b-2,x:wt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,b=p.length,g;++h<b;)f[(g=p[h]).i]=g.x(m);return f.join("")}}}var ly=Js(iy,"px, ","px)","deg)"),ry=Js(ay,", ",")",")"),sy=1e-12;function Qs(e){return((e=Math.exp(e))+1/e)/2}function cy(e){return((e=Math.exp(e))-1/e)/2}function dy(e){return((e=Math.exp(2*e))-1)/(e+1)}const ri=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,b=m*m+h*h,g,_;if(b<sy)_=Math.log(p/d)/t,g=function(q){return[s+q*m,c+q*h,d*Math.exp(t*q*_)]};else{var N=Math.sqrt(b),y=(p*p-d*d+i*b)/(2*d*o*N),$=(p*p-d*d-i*b)/(2*p*o*N),K=Math.log(Math.sqrt(y*y+1)-y),F=Math.log(Math.sqrt($*$+1)-$);_=(F-K)/t,g=function(q){var G=q*_,X=Qs(K),Q=d/(o*N)*(X*dy(t*G+K)-cy(K));return[s+Q*m,c+Q*h,d*X/Qs(t*G+K)]}}return g.duration=_*1e3*t/Math.SQRT2,g}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Rn=0,lo=0,ro=0,ec=1e3,si,so,ci=0,ln=0,di=0,co=typeof performance=="object"&&performance.now?performance:Date,tc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fa(){return ln||(tc(uy),ln=co.now()+di)}function uy(){ln=0}function ui(){this._call=this._time=this._next=null}ui.prototype=nc.prototype={constructor:ui,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Fa():+o)+(t==null?0:+t),!this._next&&so!==this&&(so?so._next=this:si=this,so=this),this._call=e,this._time=o,Ga()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ga())}};function nc(e,t,o){var i=new ui;return i.restart(e,t,o),i}function fy(){Fa(),++Rn;for(var e=si,t;e;)(t=ln-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rn}function oc(){ln=(ci=co.now())+di,Rn=lo=0;try{fy()}finally{Rn=0,py(),ln=0}}function my(){var e=co.now(),t=e-ci;t>ec&&(di-=t,ci=e)}function py(){for(var e,t=si,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:si=o);so=e,Ga(i)}function Ga(e){if(!Rn){lo&&(lo=clearTimeout(lo));var t=e-ln;t>24?(e<1/0&&(lo=setTimeout(oc,e-co.now()-di)),ro&&(ro=clearInterval(ro))):(ro||(ci=co.now(),ro=setInterval(my,ec)),Rn=1,tc(oc))}}function ic(e,t,o){var i=new ui;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var hy=jo("start","end","cancel","interrupt"),yy=[],ac=0,lc=1,Ya=2,fi=3,rc=4,Wa=5,mi=6;function pi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;gy(e,o,{name:t,index:i,group:a,on:hy,tween:yy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ac})}function Ka(e,t){var o=mt(e,t);if(o.state>ac)throw new Error("too late; already scheduled");return o}function vt(e,t){var o=mt(e,t);if(o.state>fi)throw new Error("too late; already running");return o}function mt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function gy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=nc(l,0,o.time);function l(d){o.state=lc,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==lc)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===fi)return ic(r);m.state===rc?(m.state=mi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=mi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(ic(function(){o.state===fi&&(o.state=rc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ya,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ya){for(o.state=fi,a=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Wa,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Wa&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=mi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function hi(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Ya&&i.state<Wa,i.state=mi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function by(e){return this.each(function(){hi(this,e)})}function _y(e,t){var o,i;return function(){var a=vt(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function wy(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=vt(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function vy(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=mt(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?_y:wy)(o,e,t))}function qa(e,t,o){var i=e._id;return e.each(function(){var a=vt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return mt(a,i).value[t]}}function sc(e,t){var o;return(typeof t=="number"?wt:t instanceof nn?ai:(o=nn(t))?(t=o,ai):Xs)(e,t)}function ky(e){return function(){this.removeAttribute(e)}}function Ey(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ny(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function $y(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function xy(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function Iy(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function Sy(e,t){var o=Jo(e),i=o==="transform"?ry:sc;return this.attrTween(e,typeof t=="function"?(o.local?Iy:xy)(o,i,qa(this,"attr."+e,t)):t==null?(o.local?Ey:ky)(o):(o.local?$y:Ny)(o,i,t))}function Cy(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Ry(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Vy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Ry(e,l)),o}return a._value=t,a}function Ay(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Cy(e,l)),o}return a._value=t,a}function Ty(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Jo(e);return this.tween(o,(i.local?Vy:Ay)(i,t))}function My(e,t){return function(){Ka(this,e).delay=+t.apply(this,arguments)}}function By(e,t){return t=+t,function(){Ka(this,e).delay=t}}function Dy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?My:By)(t,e)):mt(this.node(),t).delay}function Oy(e,t){return function(){vt(this,e).duration=+t.apply(this,arguments)}}function Ly(e,t){return t=+t,function(){vt(this,e).duration=t}}function Py(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oy:Ly)(t,e)):mt(this.node(),t).duration}function zy(e,t){if(typeof t!="function")throw new Error;return function(){vt(this,e).ease=t}}function Uy(e){var t=this._id;return arguments.length?this.each(zy(t,e)):mt(this.node(),t).ease}function Hy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;vt(this,e).ease=o}}function Fy(e){if(typeof e!="function")throw new Error;return this.each(Hy(this._id,e))}function Gy(e){typeof e!="function"&&(e=xs(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Ct(i,this._parents,this._name,this._id)}function Yy(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new Ct(r,this._parents,this._name,this._id)}function Wy(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function Ky(e,t,o){var i,a,l=Wy(t)?Ka:vt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function qy(e,t){var o=this._id;return arguments.length<2?mt(this.node(),o).on.on(e):this.each(Ky(o,e,t))}function Xy(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function jy(){return this.on("end.remove",Xy(this._id))}function Zy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Aa(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,pi(d[p],t,o,p,d,mt(u,o)));return new Ct(l,this._parents,t,o)}function Jy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=$s(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=mt(u,o),b=0,g=p.length;b<g;++b)(m=p[b])&&pi(m,t,o,b,p,h);l.push(p),r.push(u)}return new Ct(l,r,t,o)}var Qy=eo.prototype.constructor;function eg(){return new Qy(this._groups,this._parents)}function tg(e,t){var o,i,a;return function(){var l=In(this,e),r=(this.style.removeProperty(e),In(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function cc(e){return function(){this.style.removeProperty(e)}}function ng(e,t,o){var i,a=o+"",l;return function(){var r=In(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function og(e,t,o){var i,a,l;return function(){var r=In(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),In(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function ig(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=vt(this,e),d=c.on,u=c.value[l]==null?s||(s=cc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function ag(e,t,o){var i=(e+="")=="transform"?ly:sc;return t==null?this.styleTween(e,tg(e,i)).on("end.style."+e,cc(e)):typeof t=="function"?this.styleTween(e,og(e,i,qa(this,"style."+e,t))).each(ig(this._id,e)):this.styleTween(e,ng(e,i,t),o).on("end.style."+e,null)}function lg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function rg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&lg(e,r,o)),i}return l._value=t,l}function sg(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,rg(e,t,o??""))}function cg(e){return function(){this.textContent=e}}function dg(e){return function(){var t=e(this);this.textContent=t??""}}function ug(e){return this.tween("text",typeof e=="function"?dg(qa(this,"text",e)):cg(e==null?"":e+""))}function fg(e){return function(t){this.textContent=e.call(this,t)}}function mg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&fg(a)),t}return i._value=e,i}function pg(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,mg(e))}function hg(){for(var e=this._name,t=this._id,o=dc(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=mt(c,t);pi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ct(i,this._parents,e,o)}function yg(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=vt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var gg=0;function Ct(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function dc(){return++gg}var Rt=eo.prototype;Ct.prototype={constructor:Ct,select:Zy,selectAll:Jy,selectChild:Rt.selectChild,selectChildren:Rt.selectChildren,filter:Gy,merge:Yy,selection:eg,transition:hg,call:Rt.call,nodes:Rt.nodes,node:Rt.node,size:Rt.size,empty:Rt.empty,each:Rt.each,on:qy,attr:Sy,attrTween:Ty,style:ag,styleTween:sg,text:ug,textTween:pg,remove:jy,tween:vy,delay:Dy,duration:Py,ease:Uy,easeVarying:Fy,end:yg,[Symbol.iterator]:Rt[Symbol.iterator]};function bg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _g={time:null,delay:0,duration:250,ease:bg};function wg(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function vg(e){var t,o;e instanceof Ct?(t=e._id,e=e._name):(t=dc(),(o=_g).time=Fa(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&pi(c,e,t,d,r,o||wg(c,t));return new Ct(i,this._parents,e,t)}eo.prototype.interrupt=by,eo.prototype.transition=vg;const yi=e=>()=>e;function kg(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Vt(e,t,o){this.k=e,this.x=t,this.y=o}Vt.prototype={constructor:Vt,scale:function(e){return e===1?this:new Vt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Vn=new Vt(1,0,0);Vt.prototype;function Xa(e){e.stopImmediatePropagation()}function uo(e){e.preventDefault(),e.stopImmediatePropagation()}function Eg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ng(){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 uc(){return this.__zoom||Vn}function $g(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xg(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ig(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function Sg(){var e=Eg,t=Ng,o=Ig,i=$g,a=xg,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ri,d=jo("start","zoom","end"),u,f,p,m=500,h=150,b=0,g=10;function _(v){v.property("__zoom",uc).on("wheel.zoom",G,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",Q).filter(a).on("touchstart.zoom",de).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(v,R,E,P){var W=v.selection?v.selection():v;W.property("__zoom",uc),v!==W?K(v,R,E,P):W.interrupt().each(function(){F(this,arguments).event(P).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},_.scaleBy=function(v,R,E,P){_.scaleTo(v,function(){var W=this.__zoom.k,oe=typeof R=="function"?R.apply(this,arguments):R;return W*oe},E,P)},_.scaleTo=function(v,R,E,P){_.transform(v,function(){var W=t.apply(this,arguments),oe=this.__zoom,T=E==null?$(W):typeof E=="function"?E.apply(this,arguments):E,J=oe.invert(T),se=typeof R=="function"?R.apply(this,arguments):R;return o(y(N(oe,se),T,J),W,r)},E,P)},_.translateBy=function(v,R,E,P){_.transform(v,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),r)},null,P)},_.translateTo=function(v,R,E,P,W){_.transform(v,function(){var oe=t.apply(this,arguments),T=this.__zoom,J=P==null?$(oe):typeof P=="function"?P.apply(this,arguments):P;return o(Vn.translate(J[0],J[1]).scale(T.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof E=="function"?-E.apply(this,arguments):-E),oe,r)},P,W)};function N(v,R){return R=Math.max(l[0],Math.min(l[1],R)),R===v.k?v:new Vt(R,v.x,v.y)}function y(v,R,E){var P=R[0]-E[0]*v.k,W=R[1]-E[1]*v.k;return P===v.x&&W===v.y?v:new Vt(v.k,P,W)}function $(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function K(v,R,E,P){v.on("start.zoom",function(){F(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){F(this,arguments).event(P).end()}).tween("zoom",function(){var W=this,oe=arguments,T=F(W,oe).event(P),J=t.apply(W,oe),se=E==null?$(J):typeof E=="function"?E.apply(W,oe):E,he=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),we=W.__zoom,re=typeof R=="function"?R.apply(W,oe):R,me=c(we.invert(se).concat(he/we.k),re.invert(se).concat(he/re.k));return function(be){if(be===1)be=re;else{var xe=me(be),Ce=he/xe[2];be=new Vt(Ce,se[0]-xe[0]*Ce,se[1]-xe[1]*Ce)}T.zoom(null,be)}})}function F(v,R,E){return!E&&v.__zooming||new q(v,R)}function q(v,R){this.that=v,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,R),this.taps=0}q.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,R){return this.mouse&&v!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var R=ut(this.that).datum();d.call(v,this.that,new kg(v,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),R)}};function G(v,...R){if(!e.apply(this,arguments))return;var E=F(this,R).event(v),P=this.__zoom,W=Math.max(l[0],Math.min(l[1],P.k*Math.pow(2,i.apply(this,arguments)))),oe=bt(v);if(E.wheel)(E.mouse[0][0]!==oe[0]||E.mouse[0][1]!==oe[1])&&(E.mouse[1]=P.invert(E.mouse[0]=oe)),clearTimeout(E.wheel);else{if(P.k===W)return;E.mouse=[oe,P.invert(oe)],hi(this),E.start()}uo(v),E.wheel=setTimeout(T,h),E.zoom("mouse",o(y(N(P,W),E.mouse[0],E.mouse[1]),E.extent,r));function T(){E.wheel=null,E.end()}}function X(v,...R){if(p||!e.apply(this,arguments))return;var E=v.currentTarget,P=F(this,R,!0).event(v),W=ut(v.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),oe=bt(v,E),T=v.clientX,J=v.clientY;Ds(v.view),Xa(v),P.mouse=[oe,this.__zoom.invert(oe)],hi(this),P.start();function se(we){if(uo(we),!P.moved){var re=we.clientX-T,me=we.clientY-J;P.moved=re*re+me*me>b}P.event(we).zoom("mouse",o(y(P.that.__zoom,P.mouse[0]=bt(we,E),P.mouse[1]),P.extent,r))}function he(we){W.on("mousemove.zoom mouseup.zoom",null),Os(we.view,P.moved),uo(we),P.event(we).end()}}function Q(v,...R){if(e.apply(this,arguments)){var E=this.__zoom,P=bt(v.changedTouches?v.changedTouches[0]:v,this),W=E.invert(P),oe=E.k*(v.shiftKey?.5:2),T=o(y(N(E,oe),P,W),t.apply(this,R),r);uo(v),s>0?ut(this).transition().duration(s).call(K,T,P,v):ut(this).call(_.transform,T,P,v)}}function de(v,...R){if(e.apply(this,arguments)){var E=v.touches,P=E.length,W=F(this,R,v.changedTouches.length===P).event(v),oe,T,J,se;for(Xa(v),T=0;T<P;++T)J=E[T],se=bt(J,this),se=[se,this.__zoom.invert(se),J.identifier],W.touch0?!W.touch1&&W.touch0[2]!==se[2]&&(W.touch1=se,W.taps=0):(W.touch0=se,oe=!0,W.taps=1+!!u);u&&(u=clearTimeout(u)),oe&&(W.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),hi(this),W.start())}}function B(v,...R){if(this.__zooming){var E=F(this,R).event(v),P=v.changedTouches,W=P.length,oe,T,J,se;for(uo(v),oe=0;oe<W;++oe)T=P[oe],J=bt(T,this),E.touch0&&E.touch0[2]===T.identifier?E.touch0[0]=J:E.touch1&&E.touch1[2]===T.identifier&&(E.touch1[0]=J);if(T=E.that.__zoom,E.touch1){var he=E.touch0[0],we=E.touch0[1],re=E.touch1[0],me=E.touch1[1],be=(be=re[0]-he[0])*be+(be=re[1]-he[1])*be,xe=(xe=me[0]-we[0])*xe+(xe=me[1]-we[1])*xe;T=N(T,Math.sqrt(be/xe)),J=[(he[0]+re[0])/2,(he[1]+re[1])/2],se=[(we[0]+me[0])/2,(we[1]+me[1])/2]}else if(E.touch0)J=E.touch0[0],se=E.touch0[1];else return;E.zoom("touch",o(y(T,J,se),E.extent,r))}}function ee(v,...R){if(this.__zooming){var E=F(this,R).event(v),P=v.changedTouches,W=P.length,oe,T;for(Xa(v),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),oe=0;oe<W;++oe)T=P[oe],E.touch0&&E.touch0[2]===T.identifier?delete E.touch0:E.touch1&&E.touch1[2]===T.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(T=bt(T,this),Math.hypot(f[0]-T[0],f[1]-T[1])<g)){var J=ut(this).on("dblclick.zoom");J&&J.apply(this,arguments)}}}return _.wheelDelta=function(v){return arguments.length?(i=typeof v=="function"?v:yi(+v),_):i},_.filter=function(v){return arguments.length?(e=typeof v=="function"?v:yi(!!v),_):e},_.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:yi(!!v),_):a},_.extent=function(v){return arguments.length?(t=typeof v=="function"?v:yi([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),_):t},_.scaleExtent=function(v){return arguments.length?(l[0]=+v[0],l[1]=+v[1],_):[l[0],l[1]]},_.translateExtent=function(v){return arguments.length?(r[0][0]=+v[0][0],r[1][0]=+v[1][0],r[0][1]=+v[0][1],r[1][1]=+v[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(v){return arguments.length?(o=v,_):o},_.duration=function(v){return arguments.length?(s=+v,_):s},_.interpolate=function(v){return arguments.length?(c=v,_):c},_.on=function(){var v=d.on.apply(d,arguments);return v===d?_:v},_.clickDistance=function(v){return arguments.length?(b=(v=+v)*v,_):Math.sqrt(b)},_.tapDistance=function(v){return arguments.length?(g=+v,_):g},_}var Ie=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ie||{}),ja=(e=>(e.Partial="partial",e.Full="full",e))(ja||{}),rn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(rn||{}),At=(e=>(e.Strict="strict",e.Loose="loose",e))(At||{}),Za=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Za||{}),fo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(fo||{}),fc=(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))(fc||{});const Cg=["INPUT","SELECT","TEXTAREA"],Rg=typeof document<"u"?document:null;function Ja(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,l=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return Cg.includes(i==null?void 0:i.nodeName)||a||!!l}function Vg(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function mc(e,t,o,i){const a=t.replace("+",`
3
3
  `).replace(`
4
4
 
5
5
  `,`
6
6
  +`).split(`
7
- `).map(r=>r.trim().toLowerCase());if(l.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const a=l.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===l[s]);return i&&o.delete(e.toLowerCase()),a}function ig(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=lg(o.code,e);return Array.isArray(e)?e.some(l=>Ss(o[i],l,t,o.type==="keyup")):Ss(o[i],e,t,o.type==="keyup")}}function lg(e,t){return t.includes(e)?"code":"key"}function Fn(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??ng),i=n.shallowRef(n.toValue(e)===!0);let l=!1;const a=new Set;let r=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),r=c(d)},{immediate:!0}),Br(["blur","contextmenu"],s),Dr((...d)=>r(...d),d=>{var u,f;const p=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(l=og(d),(!l||l&&!p)&&Sl(d))return;const _=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,k=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!m&&(l||!k)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Dr((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!l||l&&!u)&&Sl(d))return;l=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){l=!1,a.clear(),i.value=n.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?ig(d,a):d}return i}const Cs="vue-flow__node-desc",Rs="vue-flow__edge-desc",ag="vue-flow__aria-live",Vs=["Enter"," ","Escape"],pn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Yo(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Wo(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function Ko(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Wt(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function As(e,t){return{x:Wt(e.x,t[0][0],t[1][0]),y:Wt(e.y,t[0][1],t[1][1])}}function Ts(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Rt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Kt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Rt(e)}function Gn(e){return Kt(e)&&"computedPosition"in e}function Xo(e){return!Number.isNaN(e)&&Number.isFinite(e)}function rg(e){return Xo(e.width)&&Xo(e.height)&&Xo(e.x)&&Xo(e.y)}function sg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Ms(e,t,o){var i,l;const a={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(l=e.targetHandle)==null?void 0:l.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??a,e,{id:e.id.toString()})}function Bs(e,t,o,i){const l=typeof e=="string"?e:e.id,a=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===l&&a.add(s[i]);return t.filter(s=>a.has(s.id))}function cg(...e){if(e.length===3){const[a,r,s]=e;return Bs(a,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Rt(a)&&a.source===i).map(a=>o.find(r=>Kt(r)&&r.id===a.target))}function dg(...e){if(e.length===3){const[a,r,s]=e;return Bs(a,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Rt(a)&&a.target===i).map(a=>o.find(r=>Kt(r)&&r.id===a.source))}function Ds({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function ug(e,t){return t.some(o=>Rt(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function Yn({x:e,y:t},{x:o,y:i,zoom:l}){return{x:e*l+o,y:t*l+i}}function Wn({x:e,y:t},{x:o,y:i,zoom:l},a=!1,r=[1,1]){const s={x:(e-o)/l,y:(t-i)/l};return a?Zo(s,r):s}function Os(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function qo({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Ls({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function fg(e,t){return Ls(Os(qo(e),qo(t)))}function Cl(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];t=Os(t,qo({...i.computedPosition,...i.dimensions}))}return Ls(t)}function Ps(e,t,o={x:0,y:0,zoom:1},i=!1,l=!1){const a={...Wn(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,p=c.height??s.height??null;if(l&&!d||u)continue;const m=Wo(a,Yo(s)),g=f===null||p===null,_=i&&m>0,k=(f??0)*(p??0);(g||_||m>=k||s.dragging)&&r.push(s)}return r}function Xt(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function hn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return qn(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function mg(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=hn(e,o),l=hn(e,t);return{top:i,right:l,bottom:i,left:l,x:l*2,y:i*2}}if(typeof e=="object"){const i=hn(e.top??e.y??0,o),l=hn(e.bottom??e.y??0,o),a=hn(e.left??e.x??0,t),r=hn(e.right??e.x??0,t);return{top:i,right:r,bottom:l,left:a,x:a+r,y:i+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function pg(e,t,o,i,l,a){const{x:r,y:s}=Yn(e,{x:t,y:o,zoom:i}),{x:c,y:d}=Yn({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=l-c,f=a-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function zs(e,t,o,i,l,a=.1){const r=mg(a,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=Wt(d,i,l),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,g=o/2-p*u,_=pg(e,m,g,u,t,o),k={left:Math.min(_.left-r.left,0),top:Math.min(_.top-r.top,0),right:Math.min(_.right-r.right,0),bottom:Math.min(_.bottom-r.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:u}}function hg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Us(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Us(o,t):!1}function Kn(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Rl(e){const t=e.ctrlKey&&Xn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Hs(e,t,o){return e<t?Wt(Math.abs(e-t),1,t)/t:e>o?-Wt(Math.abs(e-o),1,t)/t:0}function Fs(e,t,o=15,i=40){const l=Hs(e.x,i,t.width-i)*o,a=Hs(e.y,i,t.height-i)*o;return[l,a]}function Vl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let l={};if(typeof t.style=="function"?l={...t.style(t)}:t.style&&(l={...t.style}),l.width=l.width??`${t.dimensions.width}px`,l.height=l.height??`${t.dimensions.height}px`,o>0)if(typeof l.width=="string"){const a=Number(l.width.replace("px",""));l.width=`${a+o}px`}else l.width+=o;if(i>0)if(typeof l.height=="string"){const a=Number(l.height.replace("px",""));l.height=`${a+i}px`}else l.height+=i;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof l.width=="string"){const r=Number(l.width.replace("px",""));l.width=`${r+a}px`}else l.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof l.height=="string"){const r=Number(l.height.replace("px",""));l.height=`${r+a}px`}else l.height+=a;e.position.y=0}t.dimensions.width=Number(l.width.toString().replace("px","")),t.dimensions.height=Number(l.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const r=t.style;return{...r(a),...l}}:t.style={...t.style,...l}}}}function Gs(e,t){var o,i;const l=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of l)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const a=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(Gn(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[a.indexOf(r.parentNode)];c&&Gn(c)&&Vl(r,c)}break;case"dimensions":if(Gn(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const c=t[a.indexOf(r.parentNode)];c&&Gn(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Vl(r,c):n.nextTick(()=>{Vl(r,c)}))}break}return t}function Vt(e,t){return{id:e,type:"select",selected:t}}function Ys(e){return{item:e,type:"add"}}function Ws(e){return{id:e,type:"remove"}}function Ks(e,t,o,i,l){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:l||null,type:"remove"}}function At(e,t=new Set,o=!1){const i=[];for(const[l,a]of e){const r=t.has(l);!(a.selected===void 0&&!r)&&a.selected!==r&&(o&&(a.selected=r),i.push(Vt(a.id,r)))}return i}const Xs=()=>{};function _e(e){const t=new Set;let o=Xs,i=()=>!1;const l=()=>t.size>0||i(),a=p=>{o=p},r=()=>{o=Xs},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return Rn(m),{off:m}},off:d,trigger:p=>{const m=[o];return l()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(g=>g(p)))},hasListeners:l,listeners:t,setEmitter:a,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function qs(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function gg(e,t,o,i){var l,a;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Us(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&r.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((l=c.computedPosition)==null?void 0:l.x)||0,y:o.y-((a=c.computedPosition)==null?void 0:a.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(r.values())}function Al({id:e,dragItems:t,findNode:o}){const i=[];for(const l of t){const a=o(l.id);a&&i.push(a)}return[e?i.find(l=>l.id===e):i[0],i]}function Zs(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function yg(e,t,o){const[i,l,a,r]=typeof e!="string"?Zs(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-l,o.computedPosition.y+o.dimensions.height-a]]:!1}function bg(e,t,o,i){let l=e.extent||o;if((l==="parent"||!Array.isArray(l)&&(l==null?void 0:l.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const a=yg(l,e,i);a&&(l=a)}else t(new Ue(Pe.NODE_EXTENT_INVALID,e.id)),l=o;else if(Array.isArray(l)){const a=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;l=[[l[0][0]+a,l[0][1]+r],[l[1][0]+a,l[1][1]+r]]}else if(l!=="parent"&&(l!=null&&l.range)&&Array.isArray(l.range)){const[a,r,s,c]=Zs(l.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;l=[[l.range[0][0]+d+c,l.range[0][1]+u+a],[l.range[1][0]+d-r,l.range[1][1]+u-s]]}return l==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:l}function _g({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Tl(e,t,o,i,l){const a=_g(e.dimensions,bg(e,o,i,l)),r=As(t,a);return{position:{x:r.x-((l==null?void 0:l.computedPosition.x)||0),y:r.y-((l==null?void 0:l.computedPosition.y)||0)},computedPosition:r}}function gn(e,t,o=ve.Left,i=!1){const l=((t==null?void 0:t.x)??0)+e.computedPosition.x,a=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Ng(e);if(i)return{x:l+r/2,y:a+s/2};switch((t==null?void 0:t.position)??o){case ve.Top:return{x:l+r/2,y:a};case ve.Right:return{x:l+r,y:a+s/2};case ve.Bottom:return{x:l+r/2,y:a+s};case ve.Left:return{x:l,y:a+s/2}}}function js(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function vg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:l,targetHeight:a,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+l),y2:Math.max(e.y+i,t.y+a)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=qo({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*p)>0}function wg(e,t,o=!1){const i=typeof e.zIndex=="number";let l=i?e.zIndex:0;const a=t(e.source),r=t(e.target);return!a||!r?0:(o&&(l=i?e.zIndex:Math.max(a.computedPosition.z||0,r.computedPosition.z||0)),l)}var Pe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Pe||{});const Js={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
7
+ `).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function Ag(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=Tg(o.code,e);return Array.isArray(e)?e.some(a=>mc(o[i],a,t,o.type==="keyup")):mc(o[i],e,t,o.type==="keyup")}}function Tg(e,t){return t.includes(e)?"code":"key"}function mo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??Rg),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const l=new Set;let r=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),r=c(d)},{immediate:!0}),ws(["blur","contextmenu"],s),vs((...d)=>r(...d),d=>{var u,f;const p=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=Vg(d),(!a||a&&!p)&&Ja(d))return;const b=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!m&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),vs((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Ja(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,l.clear(),i.value=n.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?Ag(d,l):d}return i}const pc="vue-flow__node-desc",hc="vue-flow__edge-desc",Mg="vue-flow__aria-live",yc=["Enter"," ","Escape"],An={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function gi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function bi(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function _i(e){return{width:e.offsetWidth,height:e.offsetHeight}}function sn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function gc(e,t){return{x:sn(e.x,t[0][0],t[1][0]),y:sn(e.y,t[0][1],t[1][1])}}function bc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Ht(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function cn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Ht(e)}function po(e){return cn(e)&&"computedPosition"in e}function wi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Bg(e){return wi(e.width)&&wi(e.height)&&wi(e.x)&&wi(e.y)}function Dg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:Ye(e.data)?e.data:{},events:n.markRaw(Ye(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function _c(e,t,o){var i,a;const l={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:Ye(e.data)?e.data:{},events:n.markRaw(Ye(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function wc(e,t,o,i){const a=typeof e=="string"?e:e.id,l=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===a&&l.add(s[i]);return t.filter(s=>l.has(s.id))}function Og(...e){if(e.length===3){const[l,r,s]=e;return wc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ht(l)&&l.source===i).map(l=>o.find(r=>cn(r)&&r.id===l.target))}function Lg(...e){if(e.length===3){const[l,r,s]=e;return wc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ht(l)&&l.target===i).map(l=>o.find(r=>cn(r)&&r.id===l.source))}function vc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Pg(e,t){return t.some(o=>Ht(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function ho({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function yo({x:e,y:t},{x:o,y:i,zoom:a},l=!1,r=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return l?ki(s,r):s}function kc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function vi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Ec({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function zg(e,t){return Ec(kc(vi(e),vi(t)))}function Qa(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];t=kc(t,vi({...i.computedPosition,...i.dimensions}))}return Ec(t)}function Nc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...yo(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const m=bi(l,gi(s)),h=f===null||p===null,b=i&&m>0,g=(f??0)*(p??0);(h||b||m>=g||s.dragging)&&r.push(s)}return r}function dn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function Tn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return _o(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ug(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Tn(e,o),a=Tn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Tn(e.top??e.y??0,o),a=Tn(e.bottom??e.y??0,o),l=Tn(e.left??e.x??0,t),r=Tn(e.right??e.x??0,t);return{top:i,right:r,bottom:a,left:l,x:l+r,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hg(e,t,o,i,a,l){const{x:r,y:s}=ho(e,{x:t,y:o,zoom:i}),{x:c,y:d}=ho({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,f=l-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function $c(e,t,o,i,a,l=.1){const r=Ug(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=sn(d,i,a),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,h=o/2-p*u,b=Hg(e,m,h,u,t,o),g={left:Math.min(b.left-r.left,0),top:Math.min(b.top-r.top,0),right:Math.min(b.right-r.right,0),bottom:Math.min(b.bottom-r.bottom,0)};return{x:m-g.left+g.right,y:h-g.top+g.bottom,zoom:u}}function Fg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function xc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:xc(o,t):!1}function go(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function el(e){const t=e.ctrlKey&&bo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Ic(e,t,o){return e<t?sn(Math.abs(e-t),1,t)/t:e>o?-sn(Math.abs(e-o),1,t)/t:0}function Sc(e,t,o=15,i=40){const a=Ic(e.x,i,t.width-i)*o,l=Ic(e.y,i,t.height-i)*o;return[a,l]}function tl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+i}px`}else a.height+=i;if(e.position.x<0){const l=Math.abs(e.position.x);if(t.position.x=t.position.x-l,typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+l}px`}else a.width+=l;e.position.x=0}if(e.position.y<0){const l=Math.abs(e.position.y);if(t.position.y=t.position.y-l,typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+l}px`}else a.height+=l;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=l=>{const r=t.style;return{...r(l),...a}}:t.style={...t.style,...a}}}}function Cc(e,t){var o,i;const a=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of a)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const l=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(po(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&po(c)&&tl(r,c)}break;case"dimensions":if(po(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&po(c)&&(!!c.dimensions.width&&!!c.dimensions.height?tl(r,c):n.nextTick(()=>{tl(r,c)}))}break}return t}function Ft(e,t){return{id:e,type:"select",selected:t}}function Rc(e){return{item:e,type:"add"}}function Vc(e){return{id:e,type:"remove"}}function Ac(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Gt(e,t=new Set,o=!1){const i=[];for(const[a,l]of e){const r=t.has(a);!(l.selected===void 0&&!r)&&l.selected!==r&&(o&&(l.selected=r),i.push(Ft(l.id,r)))}return i}const Tc=()=>{};function $e(e){const t=new Set;let o=Tc,i=()=>!1;const a=()=>t.size>0||i(),l=p=>{o=p},r=()=>{o=Tc},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return Qn(m),{off:m}},off:d,trigger:p=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(h=>h(p)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Mc(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function Gg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!xc(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&r.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((l=c.computedPosition)==null?void 0:l.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(r.values())}function nl({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const l=o(a.id);l&&i.push(l)}return[e?i.find(a=>a.id===e):i[0],i]}function Bc(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Yg(e,t,o){const[i,a,l,r]=typeof e!="string"?Bc(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-l]]:!1}function Wg(e,t,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const l=Yg(a,e,i);l&&(a=l)}else t(new qe(Ge.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const l=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+l,a[0][1]+r],[a[1][0]+l,a[1][1]+r]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[l,r,s,c]=Bc(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+l],[a.range[1][0]+d-r,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function Kg({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function ol(e,t,o,i,a){const l=Kg(e.dimensions,Wg(e,o,i,a)),r=gc(t,l);return{position:{x:r.x-((a==null?void 0:a.computedPosition.x)||0),y:r.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:r}}function Mn(e,t,o=Ie.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,l=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Zg(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Ie.Top:return{x:a+r/2,y:l};case Ie.Right:return{x:a+r,y:l+s/2};case Ie.Bottom:return{x:a+r/2,y:l+s};case Ie.Left:return{x:a,y:l+s/2}}}function Dc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function qg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=vi({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*p)>0}function Xg(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const l=t(e.source),r=t(e.target);return!l||!r?0:(o&&(a=i?e.zIndex:Math.max(l.computedPosition.z||0,r.computedPosition.z||0)),a)}var Ge=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Ge||{});const Oc={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
8
8
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
9
9
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
10
10
  Node: ${e}
@@ -24,18 +24,18 @@ Edge: ${e}
24
24
  Source: ${t}
25
25
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
26
26
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
27
- 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 Ue extends Error{constructor(t,...o){var i;super((i=Js[t])==null?void 0:i.call(Js,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Ml(e){return"clientX"in e}function Eg(e){return"sourceEvent"in e}function mt(e,t){const o=Ml(e);let i,l;return o?(i=e.clientX,l=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,l=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,l=e.changedTouches[0].clientY):(i=0,l=0),{x:i-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}}const Xn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ng(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Zo(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const kg=()=>!0;function Bl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function xg(e,t,o){const i=[],l={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const a of t.values())Wo(l,Yo(a))>0&&i.push(a);return i}const $g=250;function Ig(e,t,o,i){var l,a;let r=[],s=Number.POSITIVE_INFINITY;const c=xg(e,o,t+$g);for(const d of c){const u=[...((l=d.handleBounds)==null?void 0:l.source)??[],...((a=d.handleBounds)==null?void 0:a.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:p,y:m}=gn(d,f,f.position,!0),g=Math.sqrt((p-e.x)**2+(m-e.y)**2);g>t||(g<s?(r=[{...f,x:p,y:m}],s=g):g===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function Qs(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:l,fromType:a,doc:r,lib:s,flowId:c,isValidConnection:d=kg},u,f,p,m){const g=a==="target",_=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:k,y:b}=mt(e),$=r.elementFromPoint(k,b),h=$!=null&&$.classList.contains(`${s}-flow__handle`)?$:_,S={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const X=ec(void 0,h),W=h.getAttribute("data-nodeid"),J=h.getAttribute("data-handleid"),T=h.classList.contains("connectable"),ee=h.classList.contains("connectableend");if(!W||!X)return S;const F={source:g?W:i,sourceHandle:g?J:l,target:g?i:W,targetHandle:g?l:J};S.connection=F;const O=T&&ee&&(o===Et.Strict?g&&X==="source"||!g&&X==="target":W!==i||J!==l);S.isValid=O&&d(F,{nodes:f,edges:u,sourceNode:p(F.source),targetNode:p(F.target)}),S.toHandle=tc(W,X,J,m,o,!0)}return S}function ec(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Sg(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Cg(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function tc(e,t,o,i,l,a=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=l===Et.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return f&&a?{...f,...gn(d,f,f.position,!0)}:f}const Dl={[ve.Left]:ve.Right,[ve.Right]:ve.Left,[ve.Top]:ve.Bottom,[ve.Bottom]:ve.Top},Rg=["production","prod"];function qn(e,...t){nc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function nc(){return!Rg.includes(process.env.NODE_ENV||"")}function oc(e,t,o,i,l){const a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:l,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ko(r)}}):null}function Ol(e,t,o,i,l,a=!1,r){l.value=!1,e.selected?(a||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function ze(e){return typeof n.unref(e)<"u"}function Vg(e,t,o,i){if(!e||!e.source||!e.target)return o(new Ue(Pe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let l;return Rt(e)?l=e:l={...e,id:Ds(e)},l=Ms(l,void 0,i),ug(l,t)?!1:l}function Ag(e,t,o,i,l){if(!t.source||!t.target)return l(new Ue(Pe.EDGE_INVALID,e.id)),!1;if(!o)return l(new Ue(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...r}=e;return{...r,id:i?Ds(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ic(e,t,o){const i={},l=[];for(let a=0;a<e.length;++a){const r=e[a];if(!Kt(r)){o(new Ue(Pe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const s=sg(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),l[a]=s}for(const a of l){const r=t(a.parentNode)||l.find(s=>s.id===a.parentNode);a.parentNode&&!r&&o(new Ue(Pe.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||i[a.id])&&(i[a.id]&&(a.isParent=!0),r&&(r.isParent=!0))}return l}function lc(e,t,o,i,l,a){let r=l;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${l}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),a){r=`${l}-${e}-${a}`;const d=i.get(r)||new Map;i.set(r,d.set(o,t))}}function Ll(e,t,o){e.clear();for(const i of o){const{source:l,target:a,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:l,target:a,sourceHandle:r,targetHandle:s},d=`${l}-${r}--${a}-${s}`,u=`${a}-${s}--${l}-${r}`;lc("source",c,u,e,l,r),lc("target",c,d,e,a,s)}}function ac(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Pl(e,t,o,i,l,a,r,s){const c=[];for(const d of e){const u=Rt(d)?d:Vg(d,s,l,a);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){l(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){l(new Ue(Pe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){l(new Ue(Pe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){l(new Ue(Pe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Ms(u,m,a),sourceNode:f,targetNode:p})}return c}const rc=Symbol("vueFlow"),sc=Symbol("nodeId"),cc=Symbol("nodeRef"),Tg=Symbol("edgeId"),Mg=Symbol("edgeRef"),jo=Symbol("slots");function dc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:l,nodeLookup:a,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:g,nodesSelectionActive:_,selectNodesOnDrag:k,removeSelectedElements:b,addSelectedNodes:$,updateNodePositions:h,emits:S}=Ce(),{onStart:X,onDrag:W,onStop:J,onClick:T,el:ee,disabled:F,id:K,selectable:O,dragHandle:fe}=e,w=n.shallowRef(!1);let R=[],x,G=null,H={x:void 0,y:void 0},Z={x:0,y:0},A=null,U=!1,Q=!1,me=0,pe=!1;const de=Og(),q=({x:N,y:I})=>{H={x:N,y:I};let v=!1;if(R=R.map(E=>{const C={x:N-E.distance.x,y:I-E.distance.y},{computedPosition:D}=Tl(E,o.value?Zo(C,i.value):C,S.error,r.value,E.parentNode?m(E.parentNode):void 0);return v=v||E.position.x!==D.x||E.position.y!==D.y,E.position=D,E}),Q=Q||v,!!v&&(h(R,!0,!0),w.value=!0,A)){const[E,C]=Al({id:K,dragItems:R,findNode:m});W({event:A,node:E,nodes:C})}},ce=()=>{if(!G)return;const[N,I]=Fs(Z,G,u.value);if(N!==0||I!==0){const v={x:(H.x??0)-N/c.value.zoom,y:(H.y??0)-I/c.value.zoom};p({x:N,y:I})&&q(v)}me=requestAnimationFrame(ce)},Ee=(N,I)=>{U=!0;const v=m(K);!k.value&&!g.value&&v&&(v.selected||b()),v&&n.toValue(O)&&k.value&&Ol(v,g.value,$,b,_,!1,I);const E=de(N.sourceEvent);if(H=E,R=gg(a.value,f.value,E,K),R.length){const[C,D]=Al({id:K,dragItems:R,findNode:m});X({event:N.sourceEvent,node:C,nodes:D})}},$e=(N,I)=>{var v;N.sourceEvent.type==="touchmove"&&N.sourceEvent.touches.length>1||(Q=!1,s.value===0&&Ee(N,I),H=de(N.sourceEvent),G=((v=t.value)==null?void 0:v.getBoundingClientRect())||null,Z=mt(N.sourceEvent,G))},ke=(N,I)=>{const v=de(N.sourceEvent);if(!pe&&U&&d.value&&(pe=!0,ce()),!U){const E=v.xSnapped-(H.x??0),C=v.ySnapped-(H.y??0);Math.sqrt(E*E+C*C)>s.value&&Ee(N,I)}(H.x!==v.xSnapped||H.y!==v.ySnapped)&&R.length&&U&&(A=N.sourceEvent,Z=mt(N.sourceEvent,G),q(v))},he=N=>{let I=!1;if(!U&&!w.value&&!g.value){const v=N.sourceEvent,E=de(v),C=E.xSnapped-(H.x??0),D=E.ySnapped-(H.y??0),B=Math.sqrt(C*C+D*D);B!==0&&B<=s.value&&(T==null||T(v),I=!0)}if(R.length&&!I){Q&&(h(R,!1,!1),Q=!1);const[v,E]=Al({id:K,dragItems:R,findNode:m});J({event:N.sourceEvent,node:v,nodes:E})}R=[],w.value=!1,pe=!1,U=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(F),ee],([N,I],v,E)=>{if(I){const C=Je(I);N||(x=rp().on("start",D=>$e(D,I)).on("drag",D=>ke(D,I)).on("end",D=>he(D)).filter(D=>{const B=D.target,oe=n.toValue(fe);return!D.button&&(!l.value||!qs(B,`.${l.value}`,I)&&(!oe||qs(B,oe,I)))}),C.call(x)),E(()=>{C.on(".drag",null),x&&(x.on("start",null),x.on("drag",null),x.on("end",null))})}}),w}function Bg(){return{doubleClick:_e(),click:_e(),mouseEnter:_e(),mouseMove:_e(),mouseLeave:_e(),contextMenu:_e(),updateStart:_e(),update:_e(),updateEnd:_e()}}function Dg(e,t){const o=Bg();return o.doubleClick.on(i=>{var l,a;t.edgeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.edgeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.edgeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.edgeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.edgeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.edgeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.updateStart.on(i=>{var l,a;t.edgeUpdateStart(i),(a=(l=e.events)==null?void 0:l.updateStart)==null||a.call(l,i)}),o.update.on(i=>{var l,a;t.edgeUpdate(i),(a=(l=e.events)==null?void 0:l.update)==null||a.call(l,i)}),o.updateEnd.on(i=>{var l,a;t.edgeUpdateEnd(i),(a=(l=e.events)==null?void 0:l.updateEnd)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function Og(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Ce();return l=>{var a;const r=((a=i.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},s=Eg(l)?l.sourceEvent:l,{x:c,y:d}=mt(s,r),u=Wn({x:c,y:d},e.value),{x:f,y:p}=o.value?Zo(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function Jo(){return!0}function uc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:l,onEdgeUpdate:a,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:g,autoPanSpeed:_,findNode:k,panBy:b,startConnection:$,updateConnection:h,endConnection:S,emits:X,viewport:W,edges:J,nodes:T,isValidConnection:ee,nodeLookup:F}=Ce();let K=null,O=!1,fe=null;function w(x){var G;const H=n.toValue(o)==="target",Z=Ml(x),A=Ts(x.target),U=x.currentTarget;if(U&&(Z&&x.button===0||!Z)){let Q=function(V){v=mt(V,he),q=Ig(Wn(v,W.value,!1,[1,1]),u.value,F.value,D),E||(C(),E=!0);const M=Qs(V,{handle:q,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:de,doc:A,lib:"vue",flowId:s,nodeLookup:F.value},J.value,T.value,k,F.value);fe=M.handleDomNode,K=M.connection,O=Cg(!!q,M.isValid);const y={...le,isValid:O,to:M.toHandle&&O?Yn({x:M.toHandle.x,y:M.toHandle.y},W.value):v,toHandle:M.toHandle,toPosition:O&&M.toHandle?M.toHandle.position:Dl[D.position],toNode:M.toHandle?F.value.get(M.toHandle.nodeId):null};if(O&&q&&(le!=null&&le.toHandle)&&y.toHandle&&le.toHandle.type===y.toHandle.type&&le.toHandle.nodeId===y.toHandle.nodeId&&le.toHandle.id===y.toHandle.id&&le.to.x===y.to.x&&le.to.y===y.to.y)return;const L=q??M.toHandle;if(h(L&&O?Yn({x:L.x,y:L.y},W.value):v,L,Sg(!!L,O)),le=y,!q&&!O&&!fe)return Bl(I);K&&K.source!==K.target&&fe&&(Bl(I),I=fe,fe.classList.add("connecting","vue-flow__handle-connecting"),fe.classList.toggle("valid",!!O),fe.classList.toggle("vue-flow__handle-valid",!!O))},me=function(V){"touches"in V&&V.touches.length>0||((q||fe)&&K&&O&&(a?a(V,K):X.connect(K)),X.connectEnd(V),l&&(r==null||r(V)),Bl(I),cancelAnimationFrame(ce),S(V),E=!1,O=!1,K=null,fe=null,A.removeEventListener("mousemove",Q),A.removeEventListener("mouseup",me),A.removeEventListener("touchmove",Q),A.removeEventListener("touchend",me))};const pe=k(n.toValue(t));let de=n.toValue(i)||ee.value||Jo;!de&&pe&&(de=(H?pe.isValidSourcePos:pe.isValidTargetPos)||Jo);let q,ce=0;const{x:Ee,y:$e}=mt(x),ke=ec(n.toValue(l),U),he=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!he||!ke)return;const N=tc(n.toValue(t),ke,n.toValue(e),F.value,d.value);if(!N)return;let I,v=mt(x,he),E=!1;const C=()=>{if(!g.value)return;const[V,M]=Fs(v,he,_.value);b({x:V,y:M}),ce=requestAnimationFrame(C)},D={...N,nodeId:n.toValue(t),type:ke,position:N.position},B=F.value.get(n.toValue(t)),ie={inProgress:!0,isValid:null,from:gn(B,D,ve.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:B,to:v,toHandle:null,toPosition:Dl[D.position],toNode:null};$({nodeId:n.toValue(t),id:n.toValue(e),type:ke,position:(U==null?void 0:U.getAttribute("data-handlepos"))||ve.Top,...v},{x:Ee-he.left,y:$e-he.top}),X.connectStart({event:x,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:ke});let le=ie;A.addEventListener("mousemove",Q),A.addEventListener("mouseup",me),A.addEventListener("touchmove",Q),A.addEventListener("touchend",me)}}function R(x){var G,H;if(!f.value)return;const Z=n.toValue(o)==="target";if(!p.value){X.clickConnectStart({event:x,nodeId:n.toValue(t),handleId:n.toValue(e)}),$({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:ve.Top,...mt(x)},void 0,!0);return}let A=n.toValue(i)||ee.value||Jo;const U=k(n.toValue(t));if(!A&&U&&(A=(Z?U.isValidSourcePos:U.isValidTargetPos)||Jo),U&&(typeof U.connectable>"u"?m.value:U.connectable)===!1)return;const Q=Ts(x.target),me=Qs(x,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:ve.Top,...mt(x)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:A,doc:Q,lib:"vue",flowId:s,nodeLookup:F.value},J.value,T.value,k,F.value),pe=((G=me.connection)==null?void 0:G.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!pe&&X.connect(me.connection),X.clickConnectEnd(x),S(x,!0)}return{handlePointerDown:w,handleClick:R}}function Lg(){return n.inject(sc,"")}function fc(e){const t=e??Lg()??"",o=n.inject(cc,n.ref(null)),{findNode:i,edges:l,emits:a}=Ce(),r=i(t);return r||a.error(new Ue(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>Xt([r],l.value))}}function Pg(){return{doubleClick:_e(),click:_e(),mouseEnter:_e(),mouseMove:_e(),mouseLeave:_e(),contextMenu:_e(),dragStart:_e(),drag:_e(),dragStop:_e()}}function zg(e,t){const o=Pg();return o.doubleClick.on(i=>{var l,a;t.nodeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.nodeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.nodeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.nodeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.nodeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.nodeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.dragStart.on(i=>{var l,a;t.nodeDragStart(i),(a=(l=e.events)==null?void 0:l.dragStart)==null||a.call(l,i)}),o.drag.on(i=>{var l,a;t.nodeDrag(i),(a=(l=e.events)==null?void 0:l.drag)==null||a.call(l,i)}),o.dragStop.on(i=>{var l,a;t.nodeDragStop(i),(a=(l=e.events)==null?void 0:l.dragStop)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function mc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:l,snapToGrid:a,nodesDraggable:r,emits:s}=Ce();return(c,d=!1)=>{const u=a.value?l.value[0]:5,f=a.value?l.value[1]:5,p=d?4:1,m=c.x*u*p,g=c.y*f*p,_=[];for(const k of e.value)if(k.draggable||r&&typeof k.draggable>"u"){const b={x:k.computedPosition.x+m,y:k.computedPosition.y+g},{position:$}=Tl(k,b,s.error,t.value,k.parentNode?i(k.parentNode):void 0);_.push({id:k.id,position:$,from:k.position,distance:{x:c.x,y:c.y},dimensions:k.dimensions})}o(_,!0,!1)}}const Qo=.1,Ug=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Tt(){return qn("Viewport not initialized yet."),Promise.resolve(!1)}const Hg={zoomIn:Tt,zoomOut:Tt,zoomTo:Tt,fitView:Tt,setCenter:Tt,fitBounds:Tt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Tt,setTransform:Tt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Fg(e){function t(i,l){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?Dn:Bo).scaleBy(zl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{a(!0)}),i):a(!1)})}function o(i,l,a,r){return new Promise(s=>{var c;const{x:d,y:u}=As({x:-i,y:-l},e.translateExtent),f=mn.translate(-d,-u).scale(a);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?Dn:Bo).transform(zl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:l=>t(1.2,l),zoomOut:l=>t(1/1.2,l),zoomTo:(l,a)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Dn:Bo).scaleTo(zl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),l):r(!1)}),setViewport:(l,a)=>o(l.x,l.y,l.zoom,a),setTransform:(l,a)=>o(l.x,l.y,l.zoom,a),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:(l={padding:Qo,includeHiddenNodes:!1,duration:0})=>{var a,r;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((l==null?void 0:l.includeHiddenNodes)||!p.hidden)&&(!((a=l.nodes)!=null&&a.length)||(r=l.nodes)!=null&&r.length&&l.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Cl(s),{x:d,y:u,zoom:f}=zs(c,e.dimensions.width,e.dimensions.height,l.minZoom??e.minZoom,l.maxZoom??e.maxZoom,l.padding??Qo);return o(d,u,f,l)},setCenter:(l,a,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-l*s,d=e.dimensions.height/2-a*s;return o(c,d,s,r)},fitBounds:(l,a={padding:Qo})=>{const{x:r,y:s,zoom:c}=zs(l,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding??Qo);return o(r,s,c,a)},project:l=>Wn(l,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x-a,y:l.y-r};return Wn(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x+a,y:l.y+r};return Yn(s,e.viewport)}return{x:0,y:0}}}:Hg)}function zl(e,t=0,o=Ug,i=()=>{}){const l=typeof t=="number"&&t>0;return l||i(),l?e.transition().duration(t).ease(o).on("end",i):e}function Gg(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const l=()=>{i.run(()=>{let _,k,b=!!(o.nodes.value.length||o.edges.value.length);_=sn([e.modelValue,()=>{var $,h;return(h=($=e.modelValue)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setElements($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([$,h])=>{var S;(S=e.modelValue)!=null&&S.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...$,...h],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},a=()=>{i.run(()=>{let _,k,b=!!o.nodes.value.length;_=sn([e.nodes,()=>{var $,h;return(h=($=e.nodes)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setNodes($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.nodes,()=>o.nodes.value.length],([$])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...$],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},r=()=>{i.run(()=>{let _,k,b=!!o.edges.value.length;_=sn([e.edges,()=>{var $,h;return(h=($=e.edges)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setEdges($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.edges,()=>o.edges.value.length],([$])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...$],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&ze(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&ze(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&ze(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&ze(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{ze(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async k=>{let b=k;typeof t.autoConnect=="function"&&(b=await t.autoConnect(k)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{ze(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(k,b,$)=>{k?o.onConnect(_):o.hooks.value.connect.off(_),$(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(t)){const b=k;if(!_.includes(b)){const $=n.toRef(()=>t[b]),h=o[b];n.isRef(h)&&i.run(()=>{n.watch($,S=>{ze(S)&&(h.value=S)},{immediate:!0})})}}};(()=>{l(),a(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function Yg(){return{edgesChange:_e(),nodesChange:_e(),nodeDoubleClick:_e(),nodeClick:_e(),nodeMouseEnter:_e(),nodeMouseMove:_e(),nodeMouseLeave:_e(),nodeContextMenu:_e(),nodeDragStart:_e(),nodeDrag:_e(),nodeDragStop:_e(),nodesInitialized:_e(),miniMapNodeClick:_e(),miniMapNodeDoubleClick:_e(),miniMapNodeMouseEnter:_e(),miniMapNodeMouseMove:_e(),miniMapNodeMouseLeave:_e(),connect:_e(),connectStart:_e(),connectEnd:_e(),clickConnectStart:_e(),clickConnectEnd:_e(),paneReady:_e(),init:_e(),move:_e(),moveStart:_e(),moveEnd:_e(),selectionDragStart:_e(),selectionDrag:_e(),selectionDragStop:_e(),selectionContextMenu:_e(),selectionStart:_e(),selectionEnd:_e(),viewportChangeStart:_e(),viewportChange:_e(),viewportChangeEnd:_e(),paneScroll:_e(),paneClick:_e(),paneContextMenu:_e(),paneMouseEnter:_e(),paneMouseMove:_e(),paneMouseLeave:_e(),edgeContextMenu:_e(),edgeMouseEnter:_e(),edgeMouseMove:_e(),edgeMouseLeave:_e(),edgeDoubleClick:_e(),edgeClick:_e(),edgeUpdateStart:_e(),edgeUpdate:_e(),edgeUpdateEnd:_e(),updateNodeInternals:_e(),error:_e(e=>qn(e.message))}}function Wg(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[l,a]of Object.entries(t.value)){const r=s=>{e(l,s)};a.setEmitter(r),Rn(a.removeEmitter),a.setHasEmitListeners(()=>i(l)),Rn(a.removeHasEmitListeners)}});function i(l){var a;const r=Kg(l);return!!((a=o==null?void 0:o.vnode.props)==null?void 0:a[r])}}function Kg(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(l,a)=>a.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function pc(){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:$l.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Hn.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:Yt.Bezier,style:{}},connectionMode:Et.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:Xn()?"Meta":"Control",zoomActivationKeyCode:Xn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Yg(),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 Xg=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function qg(e,t,o){const i=Fg(e),l=v=>{const E=v??[];e.hooks.updateNodeInternals.trigger(E)},a=v=>dg(v,e.nodes,e.edges),r=v=>cg(v,e.nodes,e.edges),s=v=>Xt(v,e.edges),c=({id:v,type:E,nodeId:C})=>{var D;const B=v?`-${E}-${v}`:`-${E}`;return Array.from(((D=e.connectionLookup.get(`${C}${B}`))==null?void 0:D.values())??[])},d=v=>{if(v)return t.value.get(v)},u=v=>{if(v)return o.value.get(v)},f=(v,E,C)=>{var D,B;const oe=[];for(const ie of v){const le={id:ie.id,type:"position",dragging:C,from:ie.from};if(E&&(le.position=ie.position,ie.parentNode)){const V=d(ie.parentNode);le.position={x:le.position.x-(((D=V==null?void 0:V.computedPosition)==null?void 0:D.x)??0),y:le.position.y-(((B=V==null?void 0:V.computedPosition)==null?void 0:B.y)??0)}}oe.push(le)}oe!=null&&oe.length&&e.hooks.nodesChange.trigger(oe)},p=v=>{if(!e.vueFlowRef)return;const E=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!E)return;const C=window.getComputedStyle(E),{m22:D}=new window.DOMMatrixReadOnly(C.transform),B=[];for(const oe of v){const ie=oe,le=d(ie.id);if(le){const V=Ko(ie.nodeElement);if(!!(V.width&&V.height&&(le.dimensions.width!==V.width||le.dimensions.height!==V.height||ie.forceUpdate))){const y=ie.nodeElement.getBoundingClientRect();le.dimensions=V,le.handleBounds.source=oc("source",ie.nodeElement,y,D,le.id),le.handleBounds.target=oc("target",ie.nodeElement,y,D,le.id),B.push({id:le.id,type:"dimensions",dimensions:V})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),B.length&&e.hooks.nodesChange.trigger(B)},m=(v,E)=>{const C=new Set,D=new Set;for(const ie of v)Kt(ie)?C.add(ie.id):Rt(ie)&&D.add(ie.id);const B=At(t.value,C,!0),oe=At(o.value,D);if(e.multiSelectionActive){for(const ie of C)B.push(Vt(ie,E));for(const ie of D)oe.push(Vt(ie,E))}B.length&&e.hooks.nodesChange.trigger(B),oe.length&&e.hooks.edgesChange.trigger(oe)},g=v=>{if(e.multiSelectionActive){const E=v.map(C=>Vt(C.id,!0));e.hooks.nodesChange.trigger(E);return}e.hooks.nodesChange.trigger(At(t.value,new Set(v.map(E=>E.id)),!0)),e.hooks.edgesChange.trigger(At(o.value))},_=v=>{if(e.multiSelectionActive){const E=v.map(C=>Vt(C.id,!0));e.hooks.edgesChange.trigger(E);return}e.hooks.edgesChange.trigger(At(o.value,new Set(v.map(E=>E.id)))),e.hooks.nodesChange.trigger(At(t.value,new Set,!0))},k=v=>{m(v,!0)},b=v=>{const C=(v||e.nodes).map(D=>(D.selected=!1,Vt(D.id,!1)));e.hooks.nodesChange.trigger(C)},$=v=>{const C=(v||e.edges).map(D=>(D.selected=!1,Vt(D.id,!1)));e.hooks.edgesChange.trigger(C)},h=v=>{if(!v||!v.length)return m([],!1);const E=v.reduce((C,D)=>{const B=Vt(D.id,!1);return Kt(D)?C.nodes.push(B):C.edges.push(B),C},{nodes:[],edges:[]});E.nodes.length&&e.hooks.nodesChange.trigger(E.nodes),E.edges.length&&e.hooks.edgesChange.trigger(E.edges)},S=v=>{var E;(E=e.d3Zoom)==null||E.scaleExtent([v,e.maxZoom]),e.minZoom=v},X=v=>{var E;(E=e.d3Zoom)==null||E.scaleExtent([e.minZoom,v]),e.maxZoom=v},W=v=>{var E;(E=e.d3Zoom)==null||E.translateExtent(v),e.translateExtent=v},J=v=>{e.nodeExtent=v,l()},T=v=>{var E;(E=e.d3Zoom)==null||E.clickDistance(v)},ee=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},F=v=>{const E=v instanceof Function?v(e.nodes):v;!e.initialized&&!E.length||(e.nodes=ic(E,d,e.hooks.error.trigger))},K=v=>{const E=v instanceof Function?v(e.edges):v;if(!e.initialized&&!E.length)return;const C=Pl(E,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Ll(e.connectionLookup,o.value,C),e.edges=C},O=v=>{const E=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!E.length||(F(E.filter(Kt)),K(E.filter(Rt)))},fe=v=>{let E=v instanceof Function?v(e.nodes):v;E=Array.isArray(E)?E:[E];const C=ic(E,d,e.hooks.error.trigger),D=[];for(const B of C)D.push(Ys(B));D.length&&e.hooks.nodesChange.trigger(D)},w=v=>{let E=v instanceof Function?v(e.edges):v;E=Array.isArray(E)?E:[E];const C=Pl(E,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),D=[];for(const B of C)D.push(Ys(B));D.length&&e.hooks.edgesChange.trigger(D)},R=(v,E=!0,C=!1)=>{const D=v instanceof Function?v(e.nodes):v,B=Array.isArray(D)?D:[D],oe=[],ie=[];function le(M){const y=s(M);for(const L of y)(!ze(L.deletable)||L.deletable)&&ie.push(Ks(L.id,L.source,L.target,L.sourceHandle,L.targetHandle))}function V(M){const y=[];for(const L of e.nodes)L.parentNode===M&&y.push(L);if(y.length){for(const L of y)oe.push(Ws(L.id));E&&le(y);for(const L of y)V(L.id)}}for(const M of B){const y=typeof M=="string"?d(M):M;y&&(ze(y.deletable)&&!y.deletable||(oe.push(Ws(y.id)),E&&le([y]),C&&V(y.id)))}ie.length&&e.hooks.edgesChange.trigger(ie),oe.length&&e.hooks.nodesChange.trigger(oe)},x=v=>{const E=v instanceof Function?v(e.edges):v,C=Array.isArray(E)?E:[E],D=[];for(const B of C){const oe=typeof B=="string"?u(B):B;oe&&(ze(oe.deletable)&&!oe.deletable||D.push(Ks(typeof B=="string"?B:B.id,oe.source,oe.target,oe.sourceHandle,oe.targetHandle)))}e.hooks.edgesChange.trigger(D)},G=(v,E,C=!0)=>{const D=u(v.id);if(!D)return!1;const B=e.edges.indexOf(D),oe=Ag(v,E,D,C,e.hooks.error.trigger);if(oe){const[ie]=Pl([oe],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((le,V)=>V===B?ie:le),Ll(e.connectionLookup,o.value,[ie]),ie}return!1},H=(v,E,C={replace:!1})=>{const D=u(v);if(!D)return;const B=typeof E=="function"?E(D):E;D.data=C.replace?B:{...D.data,...B}},Z=v=>Gs(v,e.nodes),A=v=>{const E=Gs(v,e.edges);return Ll(e.connectionLookup,o.value,E),E},U=(v,E,C={replace:!1})=>{const D=d(v);if(!D)return;const B=typeof E=="function"?E(D):E;C.replace?e.nodes.splice(e.nodes.indexOf(D),1,B):Object.assign(D,B)},Q=(v,E,C={replace:!1})=>{const D=d(v);if(!D)return;const B=typeof E=="function"?E(D):E;D.data=C.replace?B:{...D.data,...B}},me=(v,E,C=!1)=>{C?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,E&&(e.connectionPosition=E)},pe=(v,E=null,C=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=E,e.connectionStatus=C)},de=(v,E)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,E?e.connectionClickStartHandle=null:e.connectionStartHandle=null},q=v=>{const E=rg(v),C=E?null:Gn(v)?v:d(v.id);return!E&&!C?[null,null,E]:[E?v:Yo(C),C,E]},ce=(v,E=!0,C=e.nodes)=>{const[D,B,oe]=q(v);if(!D)return[];const ie=[];for(const le of C||e.nodes){if(!oe&&(le.id===B.id||!le.computedPosition))continue;const V=Yo(le),M=Wo(V,D);(E&&M>0||M>=V.width*V.height||M>=Number(D.width)*Number(D.height))&&ie.push(le)}return ie},Ee=(v,E,C=!0)=>{const[D]=q(v);if(!D)return!1;const B=Wo(D,E);return C&&B>0||B>=Number(D.width)*Number(D.height)},$e=v=>{const{viewport:E,dimensions:C,d3Zoom:D,d3Selection:B,translateExtent:oe}=e;if(!D||!B||!v.x&&!v.y)return!1;const ie=mn.translate(E.x+v.x,E.y+v.y).scale(E.zoom),le=[[0,0],[C.width,C.height]],V=D.constrain()(ie,le,oe),M=e.viewport.x!==V.x||e.viewport.y!==V.y||e.viewport.zoom!==V.k;return D.transform(B,V),M},ke=v=>{const E=v instanceof Function?v(e):v,C=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ze(E.defaultEdgeOptions)&&(e.defaultEdgeOptions=E.defaultEdgeOptions);const D=E.modelValue||E.nodes||E.edges?[]:void 0;D&&(E.modelValue&&D.push(...E.modelValue),E.nodes&&D.push(...E.nodes),E.edges&&D.push(...E.edges),O(D));const B=()=>{ze(E.maxZoom)&&X(E.maxZoom),ze(E.minZoom)&&S(E.minZoom),ze(E.translateExtent)&&W(E.translateExtent)};for(const oe of Object.keys(E)){const ie=oe,le=E[ie];![...Xg,...C].includes(ie)&&ze(le)&&(e[ie]=le)}ll(()=>e.d3Zoom).not.toBeNull().then(B),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:O,setNodes:F,setEdges:K,addNodes:fe,addEdges:w,removeNodes:R,removeEdges:x,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:H,updateNode:U,updateNodeData:Q,applyEdgeChanges:A,applyNodeChanges:Z,addSelectedElements:k,addSelectedNodes:g,addSelectedEdges:_,setMinZoom:S,setMaxZoom:X,setTranslateExtent:W,setNodeExtent:J,setPaneClickDistance:T,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:$,startConnection:me,updateConnection:pe,endConnection:de,setInteractive:ee,setState:ke,getIntersectingNodes:ce,getIncomers:a,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ee,panBy:$e,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,E)=>i.value.zoomTo(v,E),setViewport:(v,E)=>i.value.setViewport(v,E),setTransform:(v,E)=>i.value.setTransform(v,E),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,E,C)=>i.value.setCenter(v,E,C),fitBounds:(v,E)=>i.value.fitBounds(v,E),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],E=[];for(const C of e.nodes){const{computedPosition:D,handleBounds:B,selected:oe,dimensions:ie,isParent:le,resizing:V,dragging:M,events:y,...L}=C;v.push(L)}for(const C of e.edges){const{selected:D,sourceNode:B,targetNode:oe,events:ie,...le}=C;E.push(le)}return JSON.parse(JSON.stringify({nodes:v,edges:E,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(E=>{const{nodes:C,edges:D,position:B,zoom:oe,viewport:ie}=v;C&&F(C),D&&K(D);const[le,V]=ie!=null&&ie.x&&(ie!=null&&ie.y)?[ie.x,ie.y]:B??[null,null];if(le&&V){const M=(ie==null?void 0:ie.zoom)||oe||e.viewport.zoom;return ll(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:le,y:V,zoom:M}).then(()=>{E(!0)})})}else E(!0)}),updateNodeInternals:l,viewportHelper:i,$reset:()=>{const v=pc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const E=mn.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(Wt(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),C=e.viewportRef.getBoundingClientRect(),D=[[0,0],[C.width,C.height]],B=e.d3Zoom.constrain()(E,D,v.translateExtent);e.d3Zoom.transform(e.d3Selection,B)}ke(v)},$destroy:()=>{}}}const Zg=["data-id","data-handleid","data-nodeid","data-handlepos"],jg={name:"Handle",compatConfig:{MODE:3}},qt=n.defineComponent({...jg,props:{id:{default:null},type:{},position:{default:()=>ve.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),l=n.toRef(()=>o.isValidConnection??null),{id:a,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:p}=Ce(),{id:m,node:g,nodeEl:_,connectedEdges:k}=fc(),b=n.ref(),$=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),S=n.toRef(()=>{var K,O,fe,w,R,x;return((K=r.value)==null?void 0:K.nodeId)===m&&((O=r.value)==null?void 0:O.id)===e.id&&((fe=r.value)==null?void 0:fe.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===m&&((R=c.value)==null?void 0:R.id)===e.id&&((x=c.value)==null?void 0:x.type)===i.value}),X=n.toRef(()=>{var K,O,fe;return((K=s.value)==null?void 0:K.nodeId)===m&&((O=s.value)==null?void 0:O.id)===e.id&&((fe=s.value)==null?void 0:fe.type)===i.value}),{handlePointerDown:W,handleClick:J}=uc({nodeId:m,handleId:e.id,isValidConnection:l,type:i}),T=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some(K=>{const O=K[`${i.value}Handle`];return K[i.value]!==m?!1:O?O===e.id:!0}):typeof e.connectable=="number"?k.value.filter(K=>{const O=K[`${i.value}Handle`];return K[i.value]!==m?!1:O?O===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(g,k.value):ze(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var K;if(!g.dimensions.width||!g.dimensions.height)return;const O=(K=g.handleBounds[i.value])==null?void 0:K.find(Z=>Z.id===e.id);if(!d.value||O)return;const fe=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!b.value||!fe||!e.id)return;const w=_.value.getBoundingClientRect(),R=b.value.getBoundingClientRect(),x=window.getComputedStyle(fe),{m22:G}=new window.DOMMatrixReadOnly(x.transform),H={id:e.id,position:e.position,x:(R.left-w.left)/G,y:(R.top-w.top)/G,type:i.value,nodeId:m,...Ko(b.value)};g.handleBounds[i.value]=[...g.handleBounds[i.value]??[],H]});function ee(K){const O=Ml(K);T.value&&$.value&&(O&&K.button===0||!O)&&W(K)}function F(K){!m||!s.value&&!$.value||T.value&&J(K)}return t({handleClick:J,handlePointerDown:W,onClick:F,onPointerDown:ee}),(K,O)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(a)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":K.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${K.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:T.value,connecting:X.value,connectablestart:$.value,connectableend:h.value,connectionindicator:T.value&&($.value&&!S.value||h.value&&S.value)}]]),onMousedown:ee,onTouchstartPassive:ee,onClick:F},[n.renderSlot(K.$slots,"default",{id:K.id})],42,Zg))}}),ei=function({sourcePosition:e=ve.Bottom,targetPosition:t=ve.Top,label:o,connectable:i=!0,isValidTargetPos:l,isValidSourcePos:a,data:r}){const s=r.label??o;return[n.h(qt,{type:"target",position:t,connectable:i,isValidConnection:l}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(qt,{type:"source",position:e,connectable:i,isValidConnection:a})]};ei.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ei.inheritAttrs=!1,ei.compatConfig={MODE:3};const Jg=ei,ti=function({targetPosition:e=ve.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:l}){const a=l.label??t;return[n.h(qt,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a])]};ti.props=["targetPosition","label","isValidTargetPos","connectable","data"],ti.inheritAttrs=!1,ti.compatConfig={MODE:3};const Qg=ti,ni=function({sourcePosition:e=ve.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:l}){const a=l.label??t;return[typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a]),n.h(qt,{type:"source",position:e,connectable:o,isValidConnection:i})]};ni.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ni.inheritAttrs=!1,ni.compatConfig={MODE:3};const ey=ni,ty=["transform"],ny=["width","height","x","y","rx","ry"],oy=["y"],iy={name:"EdgeText",compatConfig:{MODE:3}},ly=n.defineComponent({...iy,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(l),n.watch([()=>e.x,()=>e.y,o,()=>e.label],l);function l(){if(!o.value)return;const a=o.value.getBBox();(a.width!==t.value.width||a.height!==t.value.height)&&(t.value=a)}return(a,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*a.labelBgPadding[0]}px`,height:`${t.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:n.normalizeStyle(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,ny)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(a.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:a.labelStyle}),[n.renderSlot(a.$slots,"default",{},()=>[typeof a.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(a.label),1)],64))])],16,oy)],8,ty))}}),ay=["id","d","marker-end","marker-start"],ry=["d","stroke-width"],sy={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},oi=n.defineComponent({...sy,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),l=n.ref(null),a=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:l}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(a),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,ay),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,ry)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(ly,{key:1,ref_key:"labelEl",ref:l,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function hc({sourceX:e,sourceY:t,targetX:o,targetY:i}){const l=Math.abs(o-e)/2,a=o<e?o+l:o-l,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[a,s,l,r]}function gc({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:l,sourceControlY:a,targetControlX:r,targetControlY:s}){const c=e*.125+l*.375+r*.375+o*.125,d=t*.125+a*.375+s*.375+i*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function ii(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yc({pos:e,x1:t,y1:o,x2:i,y2:l,c:a}){let r,s;switch(e){case ve.Left:r=t-ii(t-i,a),s=o;break;case ve.Right:r=t+ii(i-t,a),s=o;break;case ve.Top:r=t,s=o-ii(o-l,a);break;case ve.Bottom:r=t,s=o+ii(l-o,a);break}return[r,s]}function bc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top,curvature:s=.25}=e,[c,d]=yc({pos:i,x1:t,y1:o,x2:l,y2:a,c:s}),[u,f]=yc({pos:r,x1:l,y1:a,x2:t,y2:o,c:s}),[p,m,g,_]=gc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${l},${a}`,p,m,g,_]}function _c({pos:e,x1:t,y1:o,x2:i,y2:l}){let a,r;switch(e){case ve.Left:case ve.Right:a=.5*(t+i),r=o;break;case ve.Top:case ve.Bottom:a=t,r=.5*(o+l);break}return[a,r]}function vc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top}=e,[s,c]=_c({pos:i,x1:t,y1:o,x2:l,y2:a}),[d,u]=_c({pos:r,x1:l,y1:a,x2:t,y2:o}),[f,p,m,g]=gc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${l},${a}`,f,p,m,g]}const wc={[ve.Left]:{x:-1,y:0},[ve.Right]:{x:1,y:0},[ve.Top]:{x:0,y:-1},[ve.Bottom]:{x:0,y:1}};function cy({source:e,sourcePosition:t=ve.Bottom,target:o}){return t===ve.Left||t===ve.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 Ec(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function dy({source:e,sourcePosition:t=ve.Bottom,target:o,targetPosition:i=ve.Top,center:l,offset:a}){const r=wc[t],s=wc[i],c={x:e.x+r.x*a,y:e.y+r.y*a},d={x:o.x+s.x*a,y:o.y+s.y*a},u=cy({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,g,_;const k={x:0,y:0},b={x:0,y:0},[$,h,S,X]=hc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){g=l.x??$,_=l.y??h;const J=[{x:g,y:c.y},{x:g,y:d.y}],T=[{x:c.x,y:_},{x:d.x,y:_}];r[f]===p?m=f==="x"?J:T:m=f==="x"?T:J}else{const J=[{x:c.x,y:d.y}],T=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?T:J:m=r.y===p?J:T,t===i){const fe=Math.abs(e[f]-o[f]);if(fe<=a){const w=Math.min(a-1,a-fe);r[f]===p?k[f]=(c[f]>e[f]?-1:1)*w:b[f]=(d[f]>o[f]?-1:1)*w}}if(t!==i){const fe=f==="x"?"y":"x",w=r[f]===s[fe],R=c[fe]>d[fe],x=c[fe]<d[fe];(r[f]===1&&(!w&&R||w&&x)||r[f]!==1&&(!w&&x||w&&R))&&(m=f==="x"?J:T)}const ee={x:c.x+k.x,y:c.y+k.y},F={x:d.x+b.x,y:d.y+b.y},K=Math.max(Math.abs(ee.x-m[0].x),Math.abs(F.x-m[0].x)),O=Math.max(Math.abs(ee.y-m[0].y),Math.abs(F.y-m[0].y));K>=O?(g=(ee.x+F.x)/2,_=m[0].y):(g=m[0].x,_=(ee.y+F.y)/2)}return[[e,{x:c.x+k.x,y:c.y+k.y},...m,{x:d.x+b.x,y:d.y+b.y},o],g,_,S,X]}function uy(e,t,o,i){const l=Math.min(Ec(e,t)/2,Ec(t,o)/2,i),{x:a,y:r}=t;if(e.x===a&&a===o.x||e.y===r&&r===o.y)return`L${a} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${a+l*d},${r}Q ${a},${r} ${a},${r+l*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${a},${r+l*c}Q ${a},${r} ${a+l*s},${r}`}function Ul(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,g,_]=dy({source:{x:t,y:o},sourcePosition:i,target:{x:l,y:a},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((b,$,h)=>{let S;return h>0&&h<f.length-1?S=uy(f[h-1],$,f[h+1],s):S=`${h===0?"M":"L"}${$.x} ${$.y}`,b+=S,b},""),p,m,g,_]}function fy(e){const{sourceX:t,sourceY:o,targetX:i,targetY:l}=e,[a,r,s,c]=hc({sourceX:t,sourceY:o,targetX:i,targetY:l});return[`M ${t},${o}L ${i},${l}`,a,r,s,c]}const my=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=fy(e);return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),Nc=n.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=Ul({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),py=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(Nc,{...e,...t,borderRadius:0})}}),hy=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=bc({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),gy=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=vc({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),yy={input:ey,default:Jg,output:Qg},by={default:hy,straight:my,step:py,smoothstep:Nc,simplebezier:gy};function _y(e,t,o){const i=n.computed(()=>_=>t.value.get(_)),l=n.computed(()=>_=>o.value.get(_)),a=n.computed(()=>{const _={...by,...e.edgeTypes},k=Object.keys(_);for(const b of e.edges)b.type&&!k.includes(b.type)&&(_[b.type]=b.type);return _}),r=n.computed(()=>{const _={...yy,...e.nodeTypes},k=Object.keys(_);for(const b of e.nodes)b.type&&!k.includes(b.type)&&(_[b.type]=b.type);return _}),s=n.computed(()=>e.onlyRenderVisibleElements?Ps(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const k of e.edges){const b=t.value.get(k.source),$=t.value.get(k.target);vg({sourcePos:b.computedPosition||{x:0,y:0},targetPos:$.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:$.dimensions.width,targetHeight:$.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(k)}return _}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const _=[];for(const k of e.nodes)k.selected&&_.push(k);return _}),f=n.computed(()=>{const _=[];for(const k of e.edges)k.selected&&_.push(k);return _}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const _=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&_.push(k);return _}),g=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:l,getElements:d,getEdgeTypes:a,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:g}}class Zt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Zt.instance;return Zt.instance=i??new Zt,o&&(o.config.globalProperties.$vueFlowStorage=Zt.instance),Zt.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=pc(),l=n.reactive(i),a={};for(const[p,m]of Object.entries(l.hooks)){const g=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;a[g]=m.on}const r={};for(const[p,m]of Object.entries(l.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of l.nodes)p.set(m.id,m);return p}),c=n.computed(()=>{const p=new Map;for(const m of l.edges)p.set(m.id,m);return p}),d=_y(l,s,c),u=qg(l,s,c);u.setState({...l,...o});const f={...a,...d,...u,...gf(l),nodeLookup:s,edgeLookup:c,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function Ce(e){const t=Zt.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",l=i?e:{id:e},a=l.id,r=a??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(rc,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=a??t.getId(),d=t.create(c,l);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,p,m)=>{const g=k=>{d.applyNodeChanges(k)},_=k=>{d.applyEdgeChanges(k)};f?(d.onNodesChange(g),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(g),d.hooks.value.edgesChange.off(_)),m(()=>{d.hooks.value.nodesChange.off(g),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),Rn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():qn(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(l);if(o&&(n.provide(rc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Ue(Pe.USEVUEFLOW_OPTIONS))}return s}function vy(e){const{emits:t,dimensions:o}=Ce();let i;n.onMounted(()=>{const l=()=>{var a,r;if(!e.value||!(((r=(a=e.value).checkVisibility)==null?void 0:r.call(a))??!0))return;const s=Ko(e.value);(s.width===0||s.height===0)&&t.error(new Ue(Pe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};l(),window.addEventListener("resize",l),e.value&&(i=new ResizeObserver(()=>l()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",l),i&&e.value&&i.unobserve(e.value)})})}const wy={name:"UserSelection",compatConfig:{MODE:3}},Ey=n.defineComponent({...wy,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Ny=["tabIndex"],ky={name:"NodesSelection",compatConfig:{MODE:3}},xy=n.defineComponent({...ky,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:l,disableKeyboardA11y:a,userSelectionActive:r}=Ce(),s=mc(),c=n.ref(null),d=dc({el:c,onStart(g){t.selectionDragStart(g),t.nodeDragStart(g)},onDrag(g){t.selectionDrag(g),t.nodeDrag(g)},onStop(g){t.selectionDragStop(g),t.nodeDragStop(g)}});n.onMounted(()=>{var g;a.value||(g=c.value)==null||g.focus({preventScroll:!0})});const u=n.computed(()=>Cl(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(g){t.selectionContextMenu({event:g,nodes:i.value})}function m(g){a.value||pn[g.key]&&(g.preventDefault(),s({x:pn[g.key].x,y:pn[g.key].y},g.shiftKey))}return(g,_)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(l)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(a)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,Ny)],6)):n.createCommentVNode("",!0)}});function $y(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Iy={name:"Pane",compatConfig:{MODE:3}},Sy=n.defineComponent({...Iy,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:l,userSelectionActive:a,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:g,deleteKeyCode:_,multiSelectionKeyCode:k,multiSelectionActive:b,edgeLookup:$,nodeLookup:h,connectionLookup:S,defaultEdgeOptions:X,connectionStartHandle:W,panOnDrag:J}=Ce(),T=n.shallowRef(null),ee=n.shallowRef(new Set),F=n.shallowRef(new Set),K=n.shallowRef(null),O=n.toRef(()=>c.value&&(e.isSelecting||a.value)),fe=n.toRef(()=>W.value!==null);let w=!1,R=!1;const x=Fn(_,{actInsideInputWithModifier:!1}),G=Fn(k);n.watch(x,de=>{de&&(p(f.value),m(u.value),d.value=!1)}),n.watch(G,de=>{b.value=de});function H(de,q){return ce=>{ce.target===q&&(de==null||de(ce))}}function Z(de){if(w||fe.value){w=!1;return}l.paneClick(de),r(),d.value=!1}function A(de){var q;if(Array.isArray(J.value)&&((q=J.value)!=null&&q.includes(2))){de.preventDefault();return}l.paneContextMenu(de)}function U(de){l.paneScroll(de)}function Q(de){var q,ce,Ee;if(K.value=((q=t.value)==null?void 0:q.getBoundingClientRect())??null,!c.value||!e.isSelecting||de.button!==0||de.target!==T.value||!K.value)return;(Ee=(ce=de.target)==null?void 0:ce.setPointerCapture)==null||Ee.call(ce,de.pointerId);const{x:$e,y:ke}=$y(de,K.value);R=!0,w=!1,r(),s.value={width:0,height:0,startX:$e,startY:ke,x:$e,y:ke},l.selectionStart(de)}function me(de){var q;if(!K.value||!s.value)return;w=!0;const{x:ce,y:Ee}=mt(de,K.value),{startX:$e=0,startY:ke=0}=s.value,he={startX:$e,startY:ke,x:ce<$e?ce:$e,y:Ee<ke?Ee:ke,width:Math.abs(ce-$e),height:Math.abs(Ee-ke)},N=ee.value,I=F.value;ee.value=new Set(Ps(o.value,he,i.value,g.value===$l.Partial,!0).map(E=>E.id)),F.value=new Set;const v=((q=X.value)==null?void 0:q.selectable)??!0;for(const E of ee.value){const C=S.value.get(E);if(C)for(const{edgeId:D}of C.values()){const B=$.value.get(D);B&&(B.selectable??v)&&F.value.add(D)}}if(!ac(N,ee.value)){const E=At(h.value,ee.value,!0);l.nodesChange(E)}if(!ac(I,F.value)){const E=At($.value,F.value);l.edgesChange(E)}s.value=he,a.value=!0,d.value=!1}function pe(de){var q;de.button!==0||!R||((q=de.target)==null||q.releasePointerCapture(de.pointerId),!a.value&&s.value&&de.target===T.value&&Z(de),a.value=!1,s.value=null,d.value=ee.value.size>0,l.selectionEnd(de),e.selectionKeyPressed&&(w=!1),R=!1)}return(de,q)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:T,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:de.isSelecting}]),onClick:q[0]||(q[0]=ce=>O.value?void 0:H(Z,T.value)(ce)),onContextmenu:q[1]||(q[1]=ce=>H(A,T.value)(ce)),onWheelPassive:q[2]||(q[2]=ce=>H(U,T.value)(ce)),onPointerenter:q[3]||(q[3]=ce=>O.value?void 0:n.unref(l).paneMouseEnter(ce)),onPointerdown:q[4]||(q[4]=ce=>O.value?Q(ce):n.unref(l).paneMouseMove(ce)),onPointermove:q[5]||(q[5]=ce=>O.value?me(ce):n.unref(l).paneMouseMove(ce)),onPointerup:q[6]||(q[6]=ce=>O.value?pe(ce):void 0),onPointerleave:q[7]||(q[7]=ce=>n.unref(l).paneMouseLeave(ce))},[n.renderSlot(de.$slots,"default"),n.unref(a)&&n.unref(s)?(n.openBlock(),n.createBlock(Ey,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(f).length?(n.openBlock(),n.createBlock(xy,{key:1})):n.createCommentVNode("",!0)],34))}}),Cy={name:"Transform",compatConfig:{MODE:3}},Ry=n.defineComponent({...Cy,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Ce(),l=n.computed(()=>o.value?!i.value:!1),a=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:a.value,opacity:l.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),Vy={name:"Viewport",compatConfig:{MODE:3}},Ay=n.defineComponent({...Vy,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:l,zoomActivationKeyCode:a,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:g,preventScrolling:_,noWheelClassName:k,noPanClassName:b,emits:$,connectionStartHandle:h,userSelectionActive:S,paneDragging:X,d3Zoom:W,d3Selection:J,d3ZoomHandler:T,viewport:ee,viewportRef:F,paneClickDistance:K}=Ce();vy(F);const O=n.shallowRef(!1),fe=n.shallowRef(!1);let w=null,R=!1,x=0,G={x:0,y:0,zoom:0};const H=Fn(s),Z=Fn(r),A=Fn(a),U=n.toRef(()=>(!Z.value||Z.value&&r.value===!0)&&(H.value||f.value)),Q=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&U.value!==!0),pe=n.toRef(()=>Z.value&&r.value!==!0||S.value||me.value),de=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!F.value){qn("Viewport element is missing");return}const ke=F.value,he=ke.getBoundingClientRect(),N=eg().clickDistance(K.value).scaleExtent([t.value,o.value]).translateExtent(l.value),I=Je(ke).call(N),v=I.on("wheel.zoom"),E=mn.translate(i.value.x??0,i.value.y??0).scale(Wt(i.value.zoom??1,t.value,o.value)),C=[[0,0],[he.width,he.height]],D=N.constrain()(E,C,l.value);N.transform(I,D),N.wheelDelta(Rl),W.value=N,J.value=I,T.value=v,ee.value={x:D.x,y:D.y,zoom:D.k},N.on("start",B=>{var oe;if(!B.sourceEvent)return null;x=B.sourceEvent.button,O.value=!0;const ie=Ee(B.transform);((oe=B.sourceEvent)==null?void 0:oe.type)==="mousedown"&&(X.value=!0),G=ie,$.viewportChangeStart(ie),$.moveStart({event:B,flowTransform:ie})}),N.on("end",B=>{if(!B.sourceEvent)return null;if(O.value=!1,X.value=!1,q(U.value,x??0)&&!R&&$.paneContextMenu(B.sourceEvent),R=!1,ce(G,B.transform)){const oe=Ee(B.transform);G=oe,$.viewportChangeEnd(oe),$.moveEnd({event:B,flowTransform:oe})}}),N.filter(B=>{var oe;const ie=A.value||g.value,le=m.value&&B.ctrlKey,V=B.button,M=B.type==="wheel";if(V===1&&B.type==="mousedown"&&($e(B,"vue-flow__node")||$e(B,"vue-flow__edge")))return!0;if(!U.value&&!ie&&!Q.value&&!p.value&&!m.value||S.value||de.value&&!M||!p.value&&B.type==="dblclick"||$e(B,k.value)&&M||$e(B,b.value)&&(!M||Q.value&&M&&!A.value)||!m.value&&B.ctrlKey&&M||!ie&&!Q.value&&!le&&M)return!1;if(!m&&B.type==="touchstart"&&((oe=B.touches)==null?void 0:oe.length)>1)return B.preventDefault(),!1;if(!U.value&&(B.type==="mousedown"||B.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&V===0||Array.isArray(f.value)&&!f.value.includes(V)&&(B.type==="mousedown"||B.type==="touchstart"))return!1;const y=Array.isArray(f.value)&&f.value.includes(V)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!V||V<=1;return(!B.ctrlKey||H.value||M)&&y}),n.watch([S,U],()=>{S.value&&!O.value?N.on("zoom",null):S.value||N.on("zoom",B=>{ee.value={x:B.transform.x,y:B.transform.y,zoom:B.transform.k};const oe=Ee(B.transform);R=q(U.value,x??0),$.viewportChange(oe),$.move({event:B,flowTransform:oe})})},{immediate:!0}),n.watch([S,Q,d,A,m,_,k],()=>{Q.value&&!A.value&&!S.value?I.on("wheel.zoom",B=>{if($e(B,k.value))return!1;const oe=A.value||g.value,ie=m.value&&B.ctrlKey;if(!(!_.value||Q.value||oe||ie))return!1;B.preventDefault(),B.stopImmediatePropagation();const V=I.property("__zoom").k||1,M=Xn();if(!H.value&&B.ctrlKey&&m.value&&M){const ge=ct(B),P=Rl(B),Y=V*2**P;N.scaleTo(I,Y,ge,B);return}const y=B.deltaMode===1?20:1;let L=d.value===Hn.Vertical?0:B.deltaX*y,ae=d.value===Hn.Horizontal?0:B.deltaY*y;!M&&B.shiftKey&&d.value!==Hn.Vertical&&!L&&ae&&(L=ae,ae=0),N.translateBy(I,-(L/V)*u.value,-(ae/V)*u.value);const ue=Ee(I.property("__zoom"));w&&clearTimeout(w),fe.value?($.move({event:B,flowTransform:ue}),$.viewportChange(ue),w=setTimeout(()=>{$.moveEnd({event:B,flowTransform:ue}),$.viewportChangeEnd(ue),fe.value=!1},150)):(fe.value=!0,$.moveStart({event:B,flowTransform:ue}),$.viewportChangeStart(ue))},{passive:!1}):typeof v<"u"&&I.on("wheel.zoom",function(B,oe){const ie=!_.value&&B.type==="wheel"&&!B.ctrlKey,le=A.value||g.value,V=m.value&&B.ctrlKey;if(!le&&!c.value&&!V&&B.type==="wheel"||ie||$e(B,k.value))return null;B.preventDefault(),v.call(this,B,oe)},{passive:!1})},{immediate:!0})});function q(ke,he){return he===2&&Array.isArray(ke)&&ke.includes(2)}function ce(ke,he){return ke.x!==he.x&&!Number.isNaN(he.x)||ke.y!==he.y&&!Number.isNaN(he.y)||ke.zoom!==he.k&&!Number.isNaN(he.k)}function Ee(ke){return{x:ke.x,y:ke.y,zoom:ke.k}}function $e(ke,he){return ke.target.closest(`.${he}`)}return(ke,he)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:F,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(Sy,{"is-selecting":pe.value,"selection-key-pressed":n.unref(Z),class:n.normalizeClass({connecting:de.value,dragging:n.unref(X),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(Ry,null,{default:n.withCtx(()=>[n.renderSlot(ke.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Ty=["id"],My=["id"],By=["id"],Dy={name:"A11yDescriptions",compatConfig:{MODE:3}},Oy=n.defineComponent({...Dy,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Ce();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Cs)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Ty),n.createElementVNode("div",{id:`${n.unref(Rs)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,My),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(ag)}-${n.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},n.toDisplayString(n.unref(i)),9,By))],64))}});function Ly(){const e=Ce();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Py(e,t,o){return o===ve.Left?e-t:o===ve.Right?e+t:e}function zy(e,t,o){return o===ve.Top?e-t:o===ve.Bottom?e+t:e}const Hl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=ve.Top,type:l}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${l}`,cx:Py(t,e,i),cy:zy(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Hl.props=["radius","centerX","centerY","position","type"],Hl.compatConfig={MODE:3};const kc=Hl,Uy=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:l,emits:a,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:g,elementsSelectable:_,edgesUpdatable:k,edgesFocusable:b,hooks:$}=Ce(),h=n.computed(()=>u(e.id)),{emit:S,on:X}=Dg(h.value,a),W=n.inject(jo),J=n.getCurrentInstance(),T=n.ref(!1),ee=n.ref(!1),F=n.ref(""),K=n.ref(null),O=n.ref("source"),fe=n.ref(null),w=n.toRef(()=>typeof h.value.selectable>"u"?_.value:h.value.selectable),R=n.toRef(()=>typeof h.value.updatable>"u"?k.value:h.value.updatable),x=n.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);n.provide(Tg,e.id),n.provide(Mg,fe);const G=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),H=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),Z=n.computed(()=>{const E=h.value.type||"default",C=W==null?void 0:W[`edge-${E}`];if(C)return C;let D=h.value.template??c.value[E];if(typeof D=="string"&&J){const B=Object.keys(J.appContext.components);B&&B.includes(E)&&(D=n.resolveComponent(E,!1))}return D&&typeof D!="string"?D:(a.error(new Ue(Pe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:A}=uc({nodeId:F,handleId:K,type:O,isValidConnection:p,edgeUpdaterType:O,onEdgeUpdate:me,onEdgeUpdateEnd:pe});return()=>{const E=f(h.value.source),C=f(h.value.target),D="pathOptions"in h.value?h.value.pathOptions:{};if(!E&&!C)return a.error(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!E)return a.error(new Ue(Pe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!C)return a.error(new Ue(Pe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||E.hidden||C.hidden)return null;let B;i.value===Et.Strict?B=E.handleBounds.source:B=[...E.handleBounds.source||[],...E.handleBounds.target||[]];const oe=js(B,h.value.sourceHandle);let ie;i.value===Et.Strict?ie=C.handleBounds.target:ie=[...C.handleBounds.target||[],...C.handleBounds.source||[]];const le=js(ie,h.value.targetHandle),V=(oe==null?void 0:oe.position)||ve.Bottom,M=(le==null?void 0:le.position)||ve.Top,{x:y,y:L}=gn(E,oe,V),{x:ae,y:ue}=gn(C,le,M);return h.value.sourceX=y,h.value.sourceY=L,h.value.targetX=ae,h.value.targetY=ue,n.h("g",{ref:fe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${Z.value===!1?"default":h.value.type||"default"}`,s.value,G.value,{updating:T.value,selected:h.value.selected,animated:h.value.animated,inactive:!w.value&&!$.value.edgeClick.hasListeners()}],tabIndex:x.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":x.value?`${Rs}-${t}`:void 0,"aria-roledescription":"edge",role:x.value?"group":"img",...h.value.domAttributes,onClick:q,onContextmenu:ce,onDblclick:Ee,onMouseenter:$e,onMousemove:ke,onMouseleave:he,onKeyDown:x.value?v:void 0},[ee.value?null:n.h(Z.value===!1?c.value.default:Z.value,{id:e.id,sourceNode:E,targetNode:C,source:h.value.source,target:h.value.target,type:h.value.type,updatable:R.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...X},style:H.value,markerStart:`url('#${Kn(h.value.markerStart,t)}')`,markerEnd:`url('#${Kn(h.value.markerEnd,t)}')`,sourcePosition:V,targetPosition:M,sourceX:y,sourceY:L,targetX:ae,targetY:ue,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...D}),[R.value==="source"||R.value===!0?[n.h("g",{onMousedown:N,onMouseenter:U,onMouseout:Q},n.h(kc,{position:V,centerX:y,centerY:L,radius:l.value,type:"source","data-type":"source"}))]:null,R.value==="target"||R.value===!0?[n.h("g",{onMousedown:I,onMouseenter:U,onMouseout:Q},n.h(kc,{position:M,centerX:ae,centerY:ue,radius:l.value,type:"target","data-type":"target"}))]:null]])};function U(){T.value=!0}function Q(){T.value=!1}function me(E,C){S.update({event:E,edge:h.value,connection:C})}function pe(E){S.updateEnd({event:E,edge:h.value}),ee.value=!1}function de(E,C){E.button===0&&(ee.value=!0,F.value=C?h.value.target:h.value.source,K.value=(C?h.value.targetHandle:h.value.sourceHandle)??null,O.value=C?"target":"source",S.updateStart({event:E,edge:h.value}),A(E))}function q(E){var C;const D={event:E,edge:h.value};w.value&&(r.value=!1,h.value.selected&&m.value?(d([h.value]),(C=fe.value)==null||C.blur()):o([h.value])),S.click(D)}function ce(E){S.contextMenu({event:E,edge:h.value})}function Ee(E){S.doubleClick({event:E,edge:h.value})}function $e(E){S.mouseEnter({event:E,edge:h.value})}function ke(E){S.mouseMove({event:E,edge:h.value})}function he(E){S.mouseLeave({event:E,edge:h.value})}function N(E){de(E,!0)}function I(E){de(E,!1)}function v(E){var C;!g.value&&Vs.includes(E.key)&&w.value&&(E.key==="Escape"?((C=fe.value)==null||C.blur(),d([u(e.id)])):o([u(e.id)]))}}}),Hy=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:l,connectionPosition:a,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=Ce(),p=(e=n.inject(jo))==null?void 0:e["connection-line"],m=n.computed(()=>{var $;return f(($=i.value)==null?void 0:$.nodeId)}),g=n.computed(()=>{var $;return f(($=l.value)==null?void 0:$.nodeId)??null}),_=n.computed(()=>({x:(a.value.x-u.value.x)/u.value.zoom,y:(a.value.y-u.value.y)/u.value.zoom})),k=n.computed(()=>c.value.markerStart?`url(#${Kn(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${Kn(c.value.markerEnd,t)})`:"");return()=>{var $,h,S;if(!m.value||!i.value)return null;const X=i.value.id,W=i.value.type,J=m.value.handleBounds;let T=(J==null?void 0:J[W])??[];if(o.value===Et.Loose){const H=(J==null?void 0:J[W==="source"?"target":"source"])??[];T=[...T,...H]}if(!T)return null;const ee=(X?T.find(H=>H.id===X):T[0])??null,F=(ee==null?void 0:ee.position)??ve.Top,{x:K,y:O}=gn(m.value,ee,F);let fe=null;g.value&&(o.value===Et.Strict?fe=(($=g.value.handleBounds[W==="source"?"target":"source"])==null?void 0:$.find(H=>{var Z;return H.id===((Z=l.value)==null?void 0:Z.id)}))||null:fe=((h=[...g.value.handleBounds.source??[],...g.value.handleBounds.target??[]])==null?void 0:h.find(H=>{var Z;return H.id===((Z=l.value)==null?void 0:Z.id)}))||null);const w=((S=l.value)==null?void 0:S.position)??(F?Dl[F]:null);if(!F||!w)return null;const R=r.value??c.value.type??Yt.Bezier;let x="";const G={sourceX:K,sourceY:O,sourcePosition:F,targetX:_.value.x,targetY:_.value.y,targetPosition:w};return R===Yt.Bezier?[x]=bc(G):R===Yt.Step?[x]=Ul({...G,borderRadius:0}):R===Yt.SmoothStep?[x]=Ul(G):R===Yt.SimpleBezier?[x]=vc(G):x=`M${K},${O} ${_.value.x},${_.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},p?n.h(p,{sourceX:K,sourceY:O,sourcePosition:F,targetX:_.value.x,targetY:_.value.y,targetPosition:w,sourceNode:m.value,sourceHandle:ee,targetNode:g.value,targetHandle:fe,markerEnd:b.value,markerStart:k.value,connectionStatus:d.value}):n.h("path",{d:x,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":k.value})))}}}),Fy=["id","markerWidth","markerHeight","markerUnits","orient"],Gy={name:"MarkerType",compatConfig:{MODE:3}},Yy=n.defineComponent({...Gy,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Il).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Il).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,Fy))}}),Wy={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ky={name:"MarkerDefinitions",compatConfig:{MODE:3}},Xy=n.defineComponent({...Ky,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:l}=Ce(),a=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=Kn(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||l.value}):s.push({id:u,color:l.value,type:d}),r.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(r,s)=>(n.openBlock(),n.createElementBlock("svg",Wy,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,c=>(n.openBlock(),n.createBlock(Yy,{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))])]))}}),qy={name:"Edges",compatConfig:{MODE:3}},Zy=n.defineComponent({...qy,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Ce();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Xy),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(wg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(Uy),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(Hy))],64))}}),jy=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:l,multiSelectionActive:a,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:g,ariaLiveMessage:_,snapToGrid:k,snapGrid:b,nodeDragThreshold:$,nodesDraggable:h,elementsSelectable:S,nodesConnectable:X,nodesFocusable:W,hooks:J}=Ce(),T=n.ref(null);n.provide(cc,T),n.provide(sc,e.id);const ee=n.inject(jo),F=n.getCurrentInstance(),K=mc(),{node:O,parentNode:fe}=fc(e.id),{emit:w,on:R}=zg(O,r),x=n.toRef(()=>typeof O.draggable>"u"?h.value:O.draggable),G=n.toRef(()=>typeof O.selectable>"u"?S.value:O.selectable),H=n.toRef(()=>typeof O.connectable>"u"?X.value:O.connectable),Z=n.toRef(()=>typeof O.focusable>"u"?W.value:O.focusable),A=n.computed(()=>G.value||x.value||J.value.nodeClick.hasListeners()||J.value.nodeDoubleClick.hasListeners()||J.value.nodeMouseEnter.hasListeners()||J.value.nodeMouseMove.hasListeners()||J.value.nodeMouseLeave.hasListeners()),U=n.toRef(()=>!!O.dimensions.width&&!!O.dimensions.height),Q=n.computed(()=>{const C=O.type||"default",D=ee==null?void 0:ee[`node-${C}`];if(D)return D;let B=O.template||f.value[C];if(typeof B=="string"&&F){const oe=Object.keys(F.appContext.components);oe&&oe.includes(C)&&(B=n.resolveComponent(C,!1))}return B&&typeof B!="string"?B:(r.error(new Ue(Pe.NODE_TYPE_MISSING,B)),!1)}),me=dc({id:e.id,el:T,disabled:()=>!x.value,selectable:G,dragHandle:()=>O.dragHandle,onStart(C){w.dragStart(C)},onDrag(C){w.drag(C)},onStop(C){w.dragStop(C)},onClick(C){v(C)}}),pe=n.computed(()=>O.class instanceof Function?O.class(O):O.class),de=n.computed(()=>{const C=(O.style instanceof Function?O.style(O):O.style)||{},D=O.width instanceof Function?O.width(O):O.width,B=O.height instanceof Function?O.height(O):O.height;return!C.width&&D&&(C.width=typeof D=="string"?D:`${D}px`),!C.height&&B&&(C.height=typeof B=="string"?B:`${B}px`),C}),q=n.toRef(()=>Number(O.zIndex??de.value.zIndex??0));return u(C=>{(C.includes(e.id)||!C.length)&&Ee()}),n.onMounted(()=>{n.watch(()=>O.hidden,(C=!1,D,B)=>{!C&&T.value&&(e.resizeObserver.observe(T.value),B(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>O.type,()=>O.sourcePosition,()=>O.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),n.watch([()=>O.position.x,()=>O.position.y,()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.x},()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.y},()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.z},q,()=>O.selected,()=>O.dimensions.height,()=>O.dimensions.width,()=>{var C;return(C=fe.value)==null?void 0:C.dimensions.height},()=>{var C;return(C=fe.value)==null?void 0:C.dimensions.width}],([C,D,B,oe,ie,le])=>{const V={x:C,y:D,z:le+(m.value&&O.selected?1e3:0)};typeof B<"u"&&typeof oe<"u"?O.computedPosition=hg({x:B,y:oe,z:ie},V):O.computedPosition=V},{flush:"post",immediate:!0}),n.watch([()=>O.extent,p],([C,D],[B,oe])=>{(C!==B||D!==oe)&&ce()}),O.extent==="parent"||typeof O.extent=="object"&&"range"in O.extent&&O.extent.range==="parent"?ll(()=>U).toBe(!0).then(ce):ce(),()=>O.hidden?null:n.h("div",{ref:T,"data-id":O.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":O.type||"default"}`,{[o.value]:x.value,dragging:me==null?void 0:me.value,draggable:x.value,selected:O.selected,selectable:G.value,parent:O.isParent},pe.value],style:{visibility:U.value?"visible":"hidden",zIndex:O.computedPosition.z??q.value,transform:`translate(${O.computedPosition.x}px,${O.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...de.value},tabIndex:Z.value?0:void 0,role:Z.value?"group":void 0,"aria-describedby":g.value?void 0:`${Cs}-${t}`,"aria-label":O.ariaLabel,"aria-roledescription":"node",...O.domAttributes,onMouseenter:$e,onMousemove:ke,onMouseleave:he,onContextmenu:N,onClick:v,onDblclick:I,onKeydown:E},[n.h(Q.value===!1?f.value.default:Q.value,{id:O.id,type:O.type,data:O.data,events:{...O.events,...R},selected:O.selected,resizing:O.resizing,dragging:me.value,connectable:H.value,position:O.computedPosition,dimensions:O.dimensions,isValidTargetPos:O.isValidTargetPos,isValidSourcePos:O.isValidSourcePos,parent:O.parentNode,parentNodeId:O.parentNode,zIndex:O.computedPosition.z??q.value,targetPosition:O.targetPosition,sourcePosition:O.sourcePosition,label:O.label,dragHandle:O.dragHandle,onUpdateNodeInternals:Ee})]);function ce(){const C=O.computedPosition,{computedPosition:D,position:B}=Tl(O,k.value?Zo(C,b.value):C,r.error,p.value,fe.value);(O.computedPosition.x!==D.x||O.computedPosition.y!==D.y)&&(O.computedPosition={...O.computedPosition,...D}),(O.position.x!==B.x||O.position.y!==B.y)&&(O.position=B)}function Ee(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function $e(C){me!=null&&me.value||w.mouseEnter({event:C,node:O})}function ke(C){me!=null&&me.value||w.mouseMove({event:C,node:O})}function he(C){me!=null&&me.value||w.mouseLeave({event:C,node:O})}function N(C){return w.contextMenu({event:C,node:O})}function I(C){return w.doubleClick({event:C,node:O})}function v(C){G.value&&(!i.value||!x.value||$.value>0)&&Ol(O,a.value,c,s,l,!1,T.value),w.click({event:C,node:O})}function E(C){if(!(Sl(C)||g.value))if(Vs.includes(C.key)&&G.value){const D=C.key==="Escape";Ol(O,a.value,c,s,l,D,T.value)}else x.value&&O.selected&&pn[C.key]&&(C.preventDefault(),_.value=`Moved selected node ${C.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~O.position.x}, y: ${~~O.position.y}`,K({x:pn[C.key].x,y:pn[C.key].y},C.shiftKey))}}});function Jy(e={includeHiddenNodes:!1}){const{nodes:t}=Ce();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const Qy={class:"vue-flow__nodes vue-flow__container"},e0={name:"Nodes",compatConfig:{MODE:3}},t0=n.defineComponent({...e0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Ce(),l=Jy(),a=n.ref();return n.watch(l,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{a.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=a.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",Qy,[a.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const p=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,p))return f;const m=(n.openBlock(),n.createBlock(n.unref(jy),{id:c.id,key:c.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):n.createCommentVNode("",!0)]))}});function n0(){const{emits:e}=Ce();n.onMounted(()=>{if(nc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ue(Pe.MISSING_STYLES))}})}const o0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),i0={name:"VueFlow",compatConfig:{MODE:3}},l0=n.defineComponent({...i0,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const i=e,l=n.useSlots(),a=al(i,"modelValue",o),r=al(i,"nodes",o),s=al(i,"edges",o),c=Ce(i),d=Gg({modelValue:a,nodes:r,edges:s},i,c);return Wg(o,c.hooks),Ly(),n0(),n.provide(jo,l),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(Ay,null,{default:n.withCtx(()=>[n.createVNode(Zy),o0,n.createVNode(t0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(Oy)],512))}}),a0={name:"Panel",compatConfig:{MODE:3}},xc=n.defineComponent({...a0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Ce(),i=n.computed(()=>`${t.position}`.split("-"));return(l,a)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(l.$slots,"default")],6))}}),Zn=["red","amber","green","teal","blue","indigo","violet","pink"],$c={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function r0(e){return typeof e=="string"&&e in $c}const s0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},c0=.15;function d0(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,l=parseInt(o.slice(2,4),16)/255,a=parseInt(o.slice(4,6),16)/255,r=Math.max(i,l,a),s=Math.min(i,l,a),c=r-s,d=(r+s)/2;let u=0,f=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),r===i?f=(l-a)/c%6:r===l?f=(a-i)/c+2:f=(i-l)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function u0(e){if(typeof e!="string")return null;const t=d0(e);if(!t||t.s<c0)return null;let o=null,i=1/0;for(const l of Zn){const a=Math.abs(t.h-s0[l]),r=Math.min(a,360-a);r<i&&(i=r,o=l)}return o}function tt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(r0(t))return t;const o=e==null?void 0:e.properties;return u0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Fl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const f0={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)"},m0={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 Ic(e,t=!1){return e?t?m0[e]:f0[e]:null}function li(e){return $c[e]}function ai(e){return`var(--em-swatch-${e}-bar)`}const p0=["width","height","innerHTML"],h0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',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"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',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"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,p0))}}),Ae=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},Ve=Ae(h0,[["__scopeId","data-v-b5f4c4ba"]]),g0={class:"em-inline-issue__msgs"},jt=Ae(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),l=n.computed(()=>{let a=null;for(const r of i.value)(a===null||o[r.severity].order<o[a].order)&&(a=r.severity);return a});return(a,r)=>l.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${l.value}`])},[n.createVNode(Ve,{name:o[l.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",g0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,c)=>(n.openBlock(),n.createElementBlock("span",{key:c},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),y0={class:"em-mlang"},b0={class:"em-mlang__tabs",role:"tablist"},_0=["aria-selected","onClick"],v0={key:0,class:"em-mlang__dot"},Gl=Ae(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function l(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const a=n.ref(l());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(a.value)||(a.value=l())});function r(d){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[d])!=null&&f.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[a.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[a.value]:u[a.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",y0,[n.createElementVNode("div",b0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":a.value===f}]),role:"tab","aria-selected":a.value===f,onClick:p=>a.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",v0,"•")):n.createCommentVNode("",!0)],10,_0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(te.BSTextArea),{key:0,name:`${e.name}-${a.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:1,name:`${e.name}-${a.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),w0=["disabled"],E0={class:"em-field"},N0={class:"em-field"},k0={class:"em-field"},x0={class:"em-class"},$0={class:"em-field"},I0={class:"em-field"},S0={class:"em-field"},C0={class:"em-field"},R0={class:"em-multilang"},V0={class:"em-multilang"},A0={class:"em-jpa"},T0={class:"em-field"},M0={class:"em-field"},B0={class:"em-field"},D0={class:"em-swatch"},O0={class:"em-swatch__row"},L0=["title","onClick"],Sc=Ae(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(F=>F.modelId===t.entityId)??null),l=n.computed(()=>i.value?o.state.layout.entityLayouts.find(F=>F.entityRef===i.value.modelId)??null:null),a=n.computed(()=>{var F;return tt(((F=l.value)==null?void 0:F.style)??void 0)}),r=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],s=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],c=["inherit","STRING","CHAR","INTEGER"],d=F=>F;function u(F){return F==="inherit"?"기본(따름)":F}function f(F){i.value&&o.updateEntity(i.value.modelId,F)}function p(F,K,O){var w;const fe=((w=i.value)==null?void 0:w.table)??{physicalName:""};f(F==="physicalName"?{table:{...fe,physicalName:O}}:{table:{...fe,logicalName:{...fe.logicalName,[K]:O}}})}function m(F){f({description:Object.keys(F).length?F:void 0})}function g(F,K){var O;f({jpaAttrs:{...(O=i.value)==null?void 0:O.jpaAttrs,[F]:K}})}function _(F,K){g(F,K)}const k=n.computed(()=>{var F,K;return((K=(F=i.value)==null?void 0:F.jpaAttrs)==null?void 0:K.discriminatorType)??"inherit"}),b=n.computed(()=>{var F,K;return!((K=(F=i.value)==null?void 0:F.jpaAttrs)!=null&&K.useDiscriminator)});function $(F){g("discriminatorType",F==="inherit"?void 0:F)}function h(F){f({hasPersonalInfo:F})}function S(F){f({superClass:F.trim()||void 0})}function X(F){f({schema:F.trim()||void 0})}function W(F){f({abstractClass:F})}const J=n.computed(()=>{var F,K;return((K=(F=i.value)==null?void 0:F.declarationOfInterfaces)==null?void 0:K.join(", "))??""});function T(F){const K=F.split(",").map(O=>O.trim()).filter(Boolean);f({declarationOfInterfaces:K.length?K:void 0})}function ee(F){i.value&&o.setEntitySwatch(i.value.modelId,F)}return(F,K)=>{var O,fe,w;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createVNode(jt,{controller:n.unref(o),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",E0,[K[12]||(K[12]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":i.value.name,"onUpdate:modelValue":K[0]||(K[0]=R=>f({name:R}))},null,8,["model-value"])]),n.createElementVNode("label",N0,[K[13]||(K[13]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":i.value.stereotype,items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":K[1]||(K[1]=R=>f({stereotype:R}))},null,8,["model-value"])]),n.createElementVNode("label",k0,[K[14]||(K[14]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":i.value.packageName??"","onUpdate:modelValue":K[2]||(K[2]=R=>f({packageName:R}))},null,8,["model-value"])]),n.createElementVNode("fieldset",x0,[K[17]||(K[17]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",$0,[K[15]||(K[15]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":i.value.superClass??"","onUpdate:modelValue":K[3]||(K[3]=R=>S(R))},null,8,["model-value"])]),n.createElementVNode("label",I0,[K[16]||(K[16]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":J.value,"onUpdate:modelValue":K[4]||(K[4]=R=>T(R))},null,8,["model-value"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!i.value.abstractClass,"onUpdate:modelValue":K[5]||(K[5]=R=>W(R))},null,8,["model-value"])]),n.createElementVNode("label",S0,[K[18]||(K[18]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((O=i.value.table)==null?void 0:O.physicalName)??"","onUpdate:modelValue":K[6]||(K[6]=R=>p("physicalName",null,R))},null,8,["model-value"])]),n.createElementVNode("label",C0,[K[19]||(K[19]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":i.value.schema??"","onUpdate:modelValue":K[7]||(K[7]=R=>X(R))},null,8,["model-value"])]),n.createElementVNode("fieldset",R0,[K[20]||(K[20]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).languages.value,R=>{var x,G;return n.openBlock(),n.createElementBlock("label",{key:R,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(R),1),n.createVNode(n.unref(te.BSTextInput),{name:`ent-logical-${R}`,width:"100%","model-value":((G=(x=i.value.table)==null?void 0:x.logicalName)==null?void 0:G[R])??"","onUpdate:modelValue":H=>p("logicalName",R,H)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",V0,[K[21]||(K[21]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:"ent-desc",languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":i.value.description,"onUpdate:modelValue":m},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",A0,[K[25]||(K[25]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(s,R=>{var x;return n.createVNode(n.unref(te.BSCheckbox),{key:R.key,name:`jpa-${R.key}`,class:"em-check",label:R.label,"model-value":!!((x=i.value.jpaAttrs)!=null&&x[R.key]),"onUpdate:modelValue":G=>_(R.key,G)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",T0,[K[22]||(K[22]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:b.value,"model-value":((fe=i.value.jpaAttrs)==null?void 0:fe.discriminatorColumnName)??"","onUpdate:modelValue":K[8]||(K[8]=R=>g("discriminatorColumnName",R.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",M0,[K[23]||(K[23]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(te.BSSelect),{disabled:b.value,"model-value":k.value,items:c,"value-provider":d,"label-provider":u,"onUpdate:modelValue":K[9]||(K[9]=R=>R&&$(R))},null,8,["disabled","model-value"])]),n.createElementVNode("label",B0,[K[24]||(K[24]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:b.value,"model-value":(w=i.value.jpaAttrs)==null?void 0:w.discriminatorLength,"onUpdate:modelValue":K[10]||(K[10]=R=>g("discriminatorLength",R||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!i.value.hasPersonalInfo,"onUpdate:modelValue":h},null,8,["model-value"]),n.createElementVNode("fieldset",D0,[K[26]||(K[26]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",O0,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":a.value===null}]),title:"없음",onClick:K[11]||(K[11]=R=>ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),R=>(n.openBlock(),n.createElementBlock("button",{key:R,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":a.value===R}]),style:n.normalizeStyle({background:n.unref(ai)(R)}),title:n.unref(li)(R),onClick:x=>ee(R)},null,14,L0))),128))])])],8,w0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a8c7f667"]]),Cc=["ko","en","ja","zh"];function P0(e){if(e)for(const t of Cc){const o=e[t];if(o)return o}}function Yl(e){const t=P0(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function z0(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Cc.some(l=>{var a,r;return(r=(a=i.label)==null?void 0:a[l])==null?void 0:r.toLowerCase().includes(o)})):e}const U0=["aria-expanded"],H0=["aria-selected","onClick","onMouseenter"],F0={key:0,class:"gcc__opt gcc__opt--empty"},Rc=Ae(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,l=n.ref(),a=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),p=n.computed(()=>f.value?Yl(f.value):"");n.watch(p,T=>{c.value||(s.value=T)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:z0(o.items,s.value));function g(){var ee;const T=(ee=l.value)==null?void 0:ee.getBoundingClientRect();T&&(u.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function _(){c.value=!0,g(),d.value=Math.max(0,m.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",J)}function k(){c.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",J)}n.onBeforeUnmount(k);function b(){_(),n.nextTick(()=>{var T;return(T=a.value)==null?void 0:T.select()})}function $(){c.value||_(),d.value=0}function h(T){i("update:modelValue",T.groupCode),s.value=Yl(T),k()}function S(){i("update:modelValue",void 0),s.value="",k()}function X(){s.value.trim()===""?S():(s.value=p.value,k())}function W(T){var ee;if(T.key==="ArrowDown")c.value||_(),d.value=Math.min(d.value+1,m.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")d.value=Math.max(d.value-1,0),T.preventDefault();else if(T.key==="Enter"){const F=m.value[d.value];F&&h(F),T.preventDefault()}else T.key==="Escape"&&(s.value=p.value,k(),(ee=a.value)==null||ee.blur())}function J(T){var F,K;const ee=T.target;!((F=l.value)!=null&&F.contains(ee))&&!((K=r.value)!=null&&K.contains(ee))&&X()}return(T,ee)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:l,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:a,"onUpdate:modelValue":ee[0]||(ee[0]=F=>s.value=F),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:b,onInput:$,onKeydown:W},null,40,U0),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[c.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:ee[1]||(ee[1]=n.withModifiers(()=>{},["prevent"])),onClick:S},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(F,K)=>(n.openBlock(),n.createElementBlock("li",{key:F.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":K===d.value,"is-selected":F.groupCode===e.modelValue}]),role:"option","aria-selected":F.groupCode===e.modelValue,onMousedown:ee[2]||(ee[2]=n.withModifiers(()=>{},["prevent"])),onClick:O=>h(F),onMouseenter:O=>d.value=K},n.toDisplayString(n.unref(Yl)(F)),43,H0))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",F0,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),G0=["disabled"],Y0={class:"em-aw__toolbar"},W0={class:"em-aw__count"},K0={class:"em-aw__scroll"},X0={class:"em-aw__table"},q0={key:0,class:"c-code"},Z0=["colspan"],j0={class:"c-del"},J0={class:"c-flag"},Q0={class:"c-flag"},e1={class:"c-flag"},t1={class:"c-flag"},n1={class:"c-flag"},o1={class:"c-flag"},i1={key:0},l1={class:"c-del"},a1=["colspan"],r1={class:"c-del"},s1={class:"em-aw__embed-label"},c1={class:"em-aw__ro"},d1={class:"em-aw__ro"},u1={class:"em-aw__ro"},f1={class:"em-aw__ro"},m1={colspan:"5"},p1=["colspan"],h1={key:0},ri="__OWN__",g1=Ae(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(V=>V.modelId===t.entityId)??null),l=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.stereotype)==="JPA_EMBEDDABLE"}),a=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var V;return(((V=i.value)==null?void 0:V.attributes)??[]).filter(M=>M.attrType!=="DIVIDER").length}),s=n.computed(()=>ee.value.length?16:15),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(V){return V==="none"?"(없음)":V}const u=V=>V;function f(V,M){i.value&&o.updateAttribute(i.value.modelId,V.modelId,M)}function p(V){return!!V.transient}const m=V=>V.value,g=V=>V.label;function _(V,M){if(!M)return;const y=X.value.find(L=>L.type===M);if(y){const L=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};f(V,{type:M,customType:void 0,dbAttrs:[{...L,dataType:y.dataType,length:y.length,scale:y.scale}]});return}f(V,M===Pt?{type:M}:{type:M,customType:void 0})}function k(V,M){f(V,{customType:M.trim()===""?void 0:M})}function b(V,M){const y=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};f(V,{dbAttrs:[{...y,...M}]})}function $(V,M,y){var L;b(V,{logicalName:{...(L=V.dbAttrs[0])==null?void 0:L.logicalName,[M]:y}})}function h(V){return V.personalInfoAttributeType??"none"}function S(V,M){f(V,{personalInfoAttributeType:M==="none"?void 0:M})}const X=n.computed(()=>o.predefinedCustomTypeCatalog.value),W=n.computed(()=>o.embeddableCatalog.value);function J(V){var M,y;return((M=V.label)==null?void 0:M.ko)??((y=V.label)==null?void 0:y.en)??V.type}function T(V){!V||!i.value||o.addPredefinedEmbed(i.value.modelId,V)}const ee=n.computed(()=>o.groupCodeCatalog.value);function F(V){var M;return((M=ee.value.find(y=>y.groupCode===V.groupCode))==null?void 0:M.codes)??[]}function K(V){return["none",...F(V)]}function O(V){return V==="none"?"none":V.code}function fe(V){var y,L;if(V==="none")return"(없음)";const M=((y=V.label)==null?void 0:y.ko)??((L=V.label)==null?void 0:L.en);return M?`${V.code} (${M})`:V.code}function w(V,M){i.value&&o.setAttributeGroupCode(i.value.modelId,V.modelId,M)}function R(V,M){f(V,{defaultValue:M==="none"?void 0:M})}function x(V,M){f(V,{defaultValue:M.trim()===""?void 0:M})}function G(V){return V.attrType.startsWith("EMBED")&&V.dbAttrs.length>0}function H(V,M,y){const L=V.dbAttrs.map((ae,ue)=>{if(ue!==M)return ae;const ge={...ae,...y};for(const P of Object.keys(y))y[P]===void 0&&delete ge[P];return ge});i.value&&o.setEmbedColumns(i.value.modelId,V.modelId,L)}function Z(V,M,y,L){var ae;H(V,M,{logicalName:{...(ae=V.dbAttrs[M])==null?void 0:ae.logicalName,[y]:L}})}function A(V,M){var ae,ue,ge;if(V.attrType==="EMBED_PREDEF"){const P=(ae=o.embeddableCatalog.value.find(Y=>Y.type===V.type))==null?void 0:ae.fields[M];return P?{name:P.name,physicalName:P.physicalName,dataType:P.dataType,length:P.length,shareable:P.shareable,logicalName:P.logicalName}:void 0}const y=(ue=V.embedded)==null?void 0:ue.embeddableRef;if(!y)return;const L=(ge=o.state.logical.entities.find(P=>P.modelId===y))==null?void 0:ge.attributes.flatMap(P=>P.dbAttrs)[M];return L?{physicalName:L.physicalName,dataType:L.dataType,length:L.length,scale:L.scale,logicalName:L.logicalName}:void 0}function U(V,M){var y,L;return((y=A(V,M))==null?void 0:y.dataType)||((L=V.dbAttrs[M])==null?void 0:L.dataType)||""}function Q(V,M){var y,L;return((y=A(V,M))==null?void 0:y.length)??((L=V.dbAttrs[M])==null?void 0:L.length)}function me(V,M){var y,L;return((y=A(V,M))==null?void 0:y.scale)??((L=V.dbAttrs[M])==null?void 0:L.scale)}const pe=["inherit","true","false"];function de(V){return V==="inherit"?"기본(따름)":V}function q(V){return(V==null?void 0:V.updatable)===void 0?"inherit":V.updatable?"true":"false"}function ce(V,M,y){H(V,M,{updatable:y==="inherit"?void 0:y==="true"})}function Ee(V,M){b(V,{updatable:M==="inherit"?void 0:M==="true"})}const $e=["inherit","true","false"];function ke(V){return V==="inherit"?"기본(따름)":V}function he(V){return(V==null?void 0:V.insertable)===void 0?"inherit":V.insertable?"true":"false"}function N(V,M,y){H(V,M,{insertable:y==="inherit"?void 0:y==="true"})}function I(V,M){b(V,{insertable:M==="inherit"?void 0:M==="true"})}const v=n.computed(()=>{var V;return $n(((V=i.value)==null?void 0:V.attributes.flatMap(M=>M.dbAttrs))??[])}),E=n.computed(()=>{var V;return(((V=i.value)==null?void 0:V.attributes)??[]).filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>({modelId:M.dbAttrs[0].modelId,label:M.dbAttrs[0].physicalName||M.name}))});function C(){return[ri,...E.value.map(V=>V.modelId)]}function D(V){if(V===ri)return"전용 컬럼(OWN)";const M=E.value.find(y=>y.modelId===V);return M?`↗ ${M.label} (공유)`:V}function B(V){return(V==null?void 0:V.sharedColumnRef)??ri}function oe(V,M,y){H(V,M,{sharedColumnRef:y===ri?void 0:y})}function ie(V){return(V==null?void 0:V.sharedColumnRef)!=null}function le(V){var M;return((M=bo(V,v.value))==null?void 0:M.physicalName)??""}return(V,M)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Y0,[n.createElementVNode("span",W0,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:M[0]||(M[0]=y=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"구분선",onClick:M[1]||(M[1]=y=>n.unref(o).addDivider(i.value.modelId))}),W.value.length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:W.value,"value-provider":y=>y.type,"label-provider":J,"onUpdate:modelValue":T},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",K0,[n.createElementVNode("table",X0,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[M[2]||(M[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),M[3]||(M[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),M[4]||(M[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),M[5]||(M[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),M[6]||(M[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[7]||(M[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),M[8]||(M[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),M[9]||(M[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),M[10]||(M[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),M[11]||(M[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),M[12]||(M[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),M[13]||(M[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),M[14]||(M[14]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),M[15]||(M[15]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),M[16]||(M[16]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),M[17]||(M[17]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),ee.value.length?(n.openBlock(),n.createElementBlock("th",q0,"코드그룹")):n.createCommentVNode("",!0),M[18]||(M[18]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),M[19]||(M[19]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,y=>{var L,ae,ue,ge,P,Y,z,j,ne,se,be;return n.openBlock(),n.createElementBlock(n.Fragment,{key:y.modelId},[y.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":a.value.has(y.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-divlabel-${y.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,Z0),n.createElementVNode("td",j0,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2)):G(y)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":a.value.has(y.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-name-${y.modelId}`,width:"100%",placeholder:"이름","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-type-${y.modelId}`,width:"100%",disabled:"","model-value":y.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:ee.value.length?15:14,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(y.dbAttrs.length)+"개",9,a1),n.createElementVNode("td",r1,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.dbAttrs,(re,we)=>{var Ie,Re,Ze,Ot,Lt,ye,Oe;return n.openBlock(),n.createElementBlock("tr",{key:re.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",s1,"↳ "+n.toDisplayString(((Ie=A(y,we))==null?void 0:Ie.name)??((Re=A(y,we))==null?void 0:Re.physicalName)??`컬럼 ${we+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",c1,n.toDisplayString(U(y,we)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-embed-logical-${re.modelId}`,width:"100%",placeholder:((Ot=(Ze=A(y,we))==null?void 0:Ze.logicalName)==null?void 0:Ot.ko)??"논리명","model-value":((Lt=re.logicalName)==null?void 0:Lt.ko)??"","onUpdate:modelValue":He=>Z(y,we,"ko",He)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-embed-col-${re.modelId}`,width:"100%",disabled:ie(re),placeholder:((ye=A(y,we))==null?void 0:ye.physicalName)??"컬럼","model-value":ie(re)?le(re):re.physicalName,"onUpdate:modelValue":He=>H(y,we,{physicalName:He})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":re.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",d1,n.toDisplayString(U(y,we)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",u1,n.toDisplayString(Q(y,we)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",f1,n.toDisplayString(me(y,we)??""),1)]),n.createElementVNode("td",m1,[(Oe=A(y,we))!=null&&Oe.shareable?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":B(re),items:C(),"value-provider":u,"label-provider":D,"onUpdate:modelValue":He=>He&&oe(y,we,He)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:ie(re),"model-value":ie(re)?"false":he(re),items:$e,"value-provider":u,"label-provider":ke,"onUpdate:modelValue":He=>He&&N(y,we,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:ie(re),"model-value":ie(re)?"false":q(re),items:pe,"value-provider":u,"label-provider":de,"onUpdate:modelValue":He=>He&&ce(y,we,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:ee.value.length?3:2},null,8,p1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":a.value.has(y.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-name-${y.modelId}`,width:"100%",placeholder:"이름","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-type-${y.modelId}`,width:"100%",placeholder:"타입",disabled:!!y.groupCode,items:n.unref(Ra)(y.type,X.value),"value-provider":m,"label-provider":g,"model-value":y.type,"onUpdate:modelValue":re=>_(y,re)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),y.type===n.unref(Pt)?(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:0,name:`aw-customtype-${y.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":y.customType??"","onUpdate:modelValue":re=>k(y,re)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-logical-${y.modelId}`,width:"100%",placeholder:"논리명","model-value":((ae=(L=y.dbAttrs[0])==null?void 0:L.logicalName)==null?void 0:ae.ko)??"","onUpdate:modelValue":re=>$(y,"ko",re)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-col-${y.modelId}`,width:"100%",placeholder:"컬럼",disabled:p(y),"model-value":((ue=y.dbAttrs[0])==null?void 0:ue.physicalName)??"","onUpdate:modelValue":re=>b(y,{physicalName:re})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":(ge=y.dbAttrs[0])==null?void 0:ge.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-dtype-${y.modelId}`,width:"100%",placeholder:"dataType",disabled:p(y),items:n.unref(Ia)(((P=y.dbAttrs[0])==null?void 0:P.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(Hi),"model-value":((Y=y.dbAttrs[0])==null?void 0:Y.dataType)??"","onUpdate:modelValue":re=>re&&b(y,{dataType:re})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSNumberInput),{name:`aw-len-${y.modelId}`,width:"100%",placeholder:"len",disabled:p(y),"model-value":(z=y.dbAttrs[0])==null?void 0:z.length,"onUpdate:modelValue":re=>b(y,{length:re||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSNumberInput),{name:`aw-scale-${y.modelId}`,width:"100%",placeholder:"scale",disabled:p(y),"model-value":(j=y.dbAttrs[0])==null?void 0:j.scale,"onUpdate:modelValue":re=>b(y,{scale:re||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",J0,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-pk-${y.modelId}`,"model-value":y.identifier,disabled:l.value||p(y),"onUpdate:modelValue":re=>f(y,{identifier:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",Q0,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-nn-${y.modelId}`,"model-value":y.notNull,disabled:p(y),"onUpdate:modelValue":re=>f(y,{notNull:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",e1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-uq-${y.modelId}`,"model-value":!!((ne=y.dbAttrs[0])!=null&&ne.unique),disabled:p(y),"onUpdate:modelValue":re=>b(y,{unique:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",t1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-ai-${y.modelId}`,"model-value":!!((se=y.dbAttrs[0])!=null&&se.autoIncrement),disabled:p(y)||!y.identifier,"onUpdate:modelValue":re=>b(y,{autoIncrement:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-tr-${y.modelId}`,"model-value":!!y.transient,disabled:y.identifier,"onUpdate:modelValue":re=>f(y,{transient:re||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-mv-${y.modelId}`,"model-value":!!((be=y.dbAttrs[0])!=null&&be.multiValue),disabled:p(y),"onUpdate:modelValue":re=>b(y,{multiValue:re||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-ins-${y.modelId}`,width:"100%",disabled:p(y),"model-value":he(y.dbAttrs[0]),items:$e,"value-provider":u,"label-provider":ke,"onUpdate:modelValue":re=>re&&I(y,re)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-upd-${y.modelId}`,width:"100%",disabled:p(y),"model-value":q(y.dbAttrs[0]),items:pe,"value-provider":u,"label-provider":de,"onUpdate:modelValue":re=>re&&Ee(y,re)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":h(y),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":re=>re&&S(y,re)},null,8,["model-value","onUpdate:modelValue"])]),ee.value.length?(n.openBlock(),n.createElementBlock("td",i1,[n.createVNode(Rc,{"model-value":y.groupCode,items:ee.value,"onUpdate:modelValue":re=>w(y,re)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[F(y).length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":y.defaultValue??"none",items:K(y),"value-provider":O,"label-provider":fe,"onUpdate:modelValue":re=>re&&R(y,re)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:1,name:`aw-default-${y.modelId}`,width:"100%",placeholder:"기본값","model-value":y.defaultValue??"","onUpdate:modelValue":re=>x(y,re)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",l1,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",h1,[...M[20]||(M[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,G0)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-eaf1fd75"]]),y1=["disabled"],b1={class:"em-idxw__list"},_1={class:"em-idxw__list-head"},v1=["onClick"],w1={class:"em-idxw__item-name"},E1={key:0,class:"em-idxw__badge"},N1={class:"em-idxw__item-cnt"},k1={key:0,class:"em-idxw__empty"},x1={key:0,class:"em-idxw__edit"},$1={class:"em-idxw__form"},I1={class:"em-field em-idxw__name"},S1={class:"em-field"},C1=["value"],R1={class:"em-idxw__transfer"},V1={class:"em-idxw__pane"},A1={class:"em-idxw__pane-head"},T1={class:"em-idxw__cols"},M1=["onClick"],B1={key:0,class:"em-idxw__empty"},D1={class:"em-idxw__arrows"},O1={class:"em-idxw__pane"},L1={class:"em-idxw__pane-head"},P1={class:"em-idxw__cols"},z1={class:"em-idxw__col-name"},U1={class:"em-idxw__col-ops"},H1=["disabled","onClick"],F1=["disabled","onClick"],G1=["onClick"],Y1={key:0,class:"em-idxw__empty"},W1={key:1,class:"em-idxw__edit em-idxw__edit--empty"},K1=Ae(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(W=>W.modelId===t.entityId)??null),l=n.computed(()=>{var W;return((W=i.value)==null?void 0:W.indexes)??[]}),a=n.computed(()=>{var W;return((W=i.value)==null?void 0:W.attributes)??[]}),r=n.ref(null);n.watch(l,W=>{var J;W.some(T=>T.modelId===r.value)||(r.value=((J=W[0])==null?void 0:J.modelId)??null)},{immediate:!0});const s=n.computed(()=>l.value.find(W=>W.modelId===r.value)??null),c=n.computed(()=>{var W;return new Set(((W=s.value)==null?void 0:W.columns.map(J=>J.columnRef))??[])}),d=n.computed(()=>a.value.filter(W=>!c.value.has(W.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(W){var T;const J=(T=W.dbAttrs[0])==null?void 0:T.physicalName;return J&&J!==W.name?`${W.name} (${J})`:W.name}function p(W){const J=a.value.find(T=>T.modelId===W);return J?f(J):W}function m(W,J){i.value&&o.updateIndex(i.value.modelId,W,J)}function g(){var J;if(!i.value)return;const W=Se();o.addIndex(i.value.modelId,{modelId:W,name:`idx_${(((J=i.value.indexes)==null?void 0:J.length)??0)+1}`,unique:!1,columns:[]}),r.value=W}function _(W){i.value&&o.removeIndex(i.value.modelId,W)}function k(W){s.value&&m(s.value.modelId,{parameters:W.trim()===""?void 0:W})}function b(W){const J=new Set(u.value);J.has(W)?J.delete(W):J.add(W),u.value=J}function $(){const W=s.value;if(!W||!u.value.size)return;const J=[...u.value].map(T=>({columnRef:T,descending:!1}));m(W.modelId,{columns:[...W.columns,...J]}),u.value=new Set}function h(W){const J=s.value;J&&m(J.modelId,{columns:J.columns.filter((T,ee)=>ee!==W)})}function S(W,J){const T=s.value;T&&m(T.modelId,{columns:T.columns.map((ee,F)=>F===W?{...ee,descending:J}:ee)})}function X(W,J){const T=s.value;if(!T)return;const ee=W+J;if(ee<0||ee>=T.columns.length)return;const F=[...T.columns];[F[W],F[ee]]=[F[ee],F[W]],m(T.modelId,{columns:F})}return(W,J)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",b1,[n.createElementVNode("div",_1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(l.value.length)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:g})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":T.modelId===r.value}]),onClick:ee=>r.value=T.modelId},[n.createElementVNode("span",w1,n.toDisplayString(T.name||"(이름 없음)"),1),T.unique?(n.openBlock(),n.createElementBlock("span",E1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",N1,n.toDisplayString(T.columns.length),1)],10,v1))),128)),l.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",k1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",x1,[n.createElementVNode("div",$1,[n.createElementVNode("label",I1,[J[4]||(J[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":J[0]||(J[0]=T=>m(s.value.modelId,{name:T}))},null,8,["model-value"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":J[1]||(J[1]=T=>m(s.value.modelId,{unique:T}))},null,8,["model-value"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:J[2]||(J[2]=T=>_(s.value.modelId))})]),n.createElementVNode("label",S1,[J[5]||(J[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:J[3]||(J[3]=T=>k(T.target.value))},null,40,C1)]),n.createElementVNode("div",R1,[n.createElementVNode("div",V1,[n.createElementVNode("div",A1,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",T1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(T.modelId)}]),onClick:ee=>b(T.modelId)},n.toDisplayString(f(T)),11,M1))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",B1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",D1,[n.createVNode(n.unref(te.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:$},null,8,["disabled"])]),n.createElementVNode("div",O1,[n.createElementVNode("div",L1,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",P1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(T,ee)=>(n.openBlock(),n.createElementBlock("li",{key:ee,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",z1,n.toDisplayString(p(T.columnRef)),1),n.createVNode(n.unref(te.BSCheckbox),{name:`idxw-desc-${ee}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":F=>S(ee,F)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",U1,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:ee===0,onClick:F=>X(ee,-1)},"↑",8,H1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:ee===s.value.columns.length-1,onClick:F=>X(ee,1)},"↓",8,F1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:F=>h(ee)},"✕",8,G1)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Y1,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",W1,"인덱스를 선택하거나 추가하세요."))],8,y1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),X1={class:"em-op-src"},q1={class:"em-op-src__actions"},Vc=Ae(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=te.useModalHandle(),i=n.ref(t.sourceCode);function l(){t.onSave(i.value),o.close()}return(a,r)=>(n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",X1,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",q1,[n.createVNode(n.unref(te.BSButton),{caption:"저장",onClick:l}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),Z1=["disabled"],j1={class:"em-ow__toolbar"},J1={class:"em-ow__count"},Q1={class:"em-ow__scroll"},eb={class:"em-ow__table"},tb={class:"c-del"},nb={key:0},ob=Ae(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModal(),l=n.computed(()=>o.state.logical.entities.find(g=>g.modelId===t.entityId)??null),a=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(g){return g==="none"?"(없음)":g}const c=g=>g;function d(g,_){l.value&&o.updateOperation(l.value.modelId,g.modelId,_)}function u(g,_,k){d(g,{description:{...g.description,[_]:k}})}function f(g){return g.personalInfoAttributeType??"none"}function p(g,_){d(g,{personalInfoAttributeType:_==="none"?void 0:_})}function m(g){i.openModal({component:Vc,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:_=>d(g,{sourceCode:_})}})}return(g,_)=>{var k,b;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",j1,[n.createElementVNode("span",J1,"오퍼레이션 ("+n.toDisplayString(((k=l.value.operations)==null?void 0:k.length)??0)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:_[0]||(_[0]=$=>n.unref(o).addOperation(l.value.modelId))})]),n.createElementVNode("div",Q1,[n.createElementVNode("table",eb,[_[2]||(_[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value.operations??[],$=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:$.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`ow-name-${$.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":$.name,"onUpdate:modelValue":S=>d($,{name:S})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":$.visibility??"PACKAGE",items:a,"value-provider":c,"label-provider":c,"onUpdate:modelValue":S=>S&&d($,{visibility:S})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`ow-desc-${$.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((h=$.description)==null?void 0:h.ko)??"","onUpdate:modelValue":S=>u($,"ko",S)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":f($),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":S=>S&&p($,S)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSButton),{variant:"text",caption:$.sourceCode?"본문 ●":"본문",onClick:S=>m($)},null,8,["caption","onClick"])]),n.createElementVNode("td",tb,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:S=>n.unref(o).removeOperation(l.value.modelId,$.modelId)},null,8,["onClick"])])])}),128)),(b=l.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",nb,[..._[1]||(_[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,Z1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),ib={key:0,class:"em-detail"},lb={class:"em-detail__tabs"},ab=["onClick"],rb=Ae(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModalHandle(),l=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(l,s=>{s||i.close()});const a=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:`엔티티 — ${((d=l.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",ib,[n.createElementVNode("nav",lb,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,ab)),64)),c[1]||(c[1]=n.createElementVNode("span",{class:"em-detail__spacer"},null,-1)),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=u=>n.unref(i).close())})]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Sc,{key:0,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(g1,{key:1,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(K1,{key:2,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(ob,{key:3,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"]))],2)])):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-6e30603a"]]);function si(e,t,o){e.openModal({component:rb,bind:{controller:n.markRaw(t),entityId:o}})}const Ac=()=>crypto.randomUUID(),sb=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,cb=e=>e&&e[0].toLowerCase()+e.slice(1),db=e=>e&&e[0].toUpperCase()+e.slice(1),ub=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function fb(e,t){return cb(e)+db(t)}function mb(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const l=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=fb(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:l,notNull:l,dbAttrs:r.dbAttrs.map(c=>({physicalName:ub(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ci=(e,t)=>`${e}::${t}`;function pb(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((a,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==a.dataType||s.length!==a.length||s.scale!==a.scale}))&&(i.dbAttrs=t.dbAttrs.map((a,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??a.physicalName,logicalName:(s==null?void 0:s.logicalName)??a.logicalName,dataType:a.dataType,length:a.length,scale:a.scale}})),Object.keys(i).length?i:null}function hb(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function di(e,t,o=Ac){const i={add:[],update:[],remove:[]},l=e.entities.find(f=>f.modelId===t);if(!l)return i;const a=e.associations.filter(f=>f.end2.entityRef===t),r=l.stereotype==="JPA_EMBEDDABLE"?[]:a.flatMap(f=>mb(e,f)),s=new Map(r.map(f=>[ci(f.associationRef,f.sourceAttributeRef),f])),c=l.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ci(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=ci(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(f.modelId)}let u=l.attributes.reduce((f,p)=>Math.max(f,p.order),-1)+1;for(const f of r){const p=ci(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(hb(f,u++,o));else{const g=pb(m,f,o);g&&i.update.push({attributeId:m.modelId,patch:g})}}return i}function gb(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(l=>l.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function yb(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function bb(e,t,o=Ac){const i=new Map,l=yb(e),a=new Set,r=[t];for(;r.length;){const s=r.shift();if(a.has(s))continue;a.add(s);const c=new Set(l.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=di(l,d,o);if(sb(u))continue;i.has(d)||i.set(d,u);const f=l.entities.find(p=>p.modelId===d);f&&gb(f,u),a.has(d)||r.push(d)}}return i}function _b(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Se(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const l of t.attributes){const a=Se();o.set(l.modelId,a),l.modelId=a;for(const r of l.dbAttrs)r.modelId=Se()}for(const l of t.indexes??[]){l.modelId=Se();for(const a of l.columns)a.columnRef=o.get(a.columnRef)??a.columnRef}return t}const Jt=Symbol("editorController");function Tc(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ui(e,t){const o=[];for(const i of t.remove)o.push(It(e,i));for(const i of t.update)o.push(zt(e,i.attributeId,i.patch));for(const i of t.add)o.push(yt(e,i));return o}function yn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function bn(e,t){const o=[];for(const[i,l]of bb(e,t,Se))o.push(...ui(i,l));return o}function Mc(e,t,o){const i=new Set(o.remove);return yn(e,t,l=>[...l.filter(a=>!i.has(a.modelId)).map(a=>{const r=o.update.find(s=>s.attributeId===a.modelId);return r?{...a,...r.patch}:a}),...o.add])}function Wl(e,t){const o=di(e,t,Se),i=ui(t,o),l=Mc(e,t,o);return i.push(...bn(l,t)),i}function Bc(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Se()}))}function vb(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let l;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,g)=>Math.max(m,g.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;l={modelId:Se(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Se(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(yt(t,l))}const a=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const p=e.associations.find(k=>k.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,g=m?p.end1:p.end2,_=m?p.end2:p.end1;a.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:t,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return l?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,l]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(a.filter(p=>p.ownerId===u.modelId).map(p=>p.dispId));return f.size?{...u,attributes:u.attributes.filter(p=>!f.has(p.modelId))}:u}),associations:e.associations.map(u=>{const f=a.find(p=>p.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=di(r,t,Se);for(const u of a){const f=s.add.find(p=>{var m;return((m=p.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of a)i.push(It(u.ownerId,u.dispId)),i.push(Eo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ui(t,s));const c=Mc(r,t,s);return i.push(...bn(c,t)),i}function wb(e,t){const o=e.entities.find(a=>a.modelId===t);if(!o)return[];const i=[],l=a=>a&&a.charAt(0).toLowerCase()+a.slice(1);for(const a of e.associations){if(a.end1.entityRef===a.end2.entityRef)continue;const r=a.end1.entityRef===t,s=a.end2.entityRef===t;if(!r&&!s)continue;const c=r?a.end2.entityRef:a.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var S;return((S=h.embedded)==null?void 0:S.associationRef)===a.modelId}))continue;const u=Se(),f=d.attributes.reduce((h,S)=>Math.max(h,S.order),-1)+1,p=new Set(d.attributes.map(h=>h.name)),m=l(o.name);let g=m;for(let h=2;p.has(g);h++)g=`${m}${h}`;const _=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:Se()})),k={modelId:u,name:g,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:_,embedded:{associationRef:a.modelId,embeddableRef:t}};i.push(yt(c,k));const b=r?"end2":"end1",$=r?"end1":"end2";i.push(Eo(a.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Se()},[$]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Eb(e=Tc(),t={}){var ke,he;const o=n.reactive(e);let i=new Wi(o);const l=n.ref(t.embeddableCatalog??[]),a=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),g=n.ref(!1),_=n.ref(!1),k=n.ref(((ke=t.meta)==null?void 0:ke.schemaVersion)??1),b=n.ref(((he=t.meta)==null?void 0:he.opWriteEnabled)??!1),$=n.computed(()=>k.value>=2&&b.value),h=n.ref(!(k.value>=2&&b.value===!1)),S=n.ref("LOGICAL_PHYSICAL"),X=n.ref("straight"),W=n.ref(!0),J=n.ref(!0),T=n.ref(null),ee=n.computed(()=>{var N;return((N=T.value)==null?void 0:N.kind)==="attribute"?{entityId:T.value.entityId,attrId:T.value.anchor}:null}),F=n.computed(()=>{var N;return((N=T.value)==null?void 0:N.kind)==="attribute"?T.value.ids:[]}),K=n.computed(()=>{var N,I;return((N=T.value)==null?void 0:N.kind)==="entity"?T.value.id:((I=T.value)==null?void 0:I.kind)==="attribute"?T.value.entityId:null}),O=n.ref(null);let fe=0;const w=n.ref(null),R=n.ref(null);let x=t.meta;function G(){i.onChange(()=>{m.value=i.canUndo,g.value=i.canRedo,_.value=i.isDirty})}G();let H=null,Z=null;function A(){Z==null||Z(),Z=null,H=null}function U(){if(A(),!$.value||!t.opTransport)return;const N=new hr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:I=>{h.value=!1,R.value=I}});N.seed((x==null?void 0:x.revSeed)??{}),Z=N.attach(i),H=N}U();const Q=n.computed(()=>_a(o.logical,o.layout)),me=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:l.value})),pe=n.computed(()=>Ta(o.logical,me.value)),de=n.computed(()=>{const N=new Map;for(const I of pe.value){if(!I.targetRef)continue;const v=N.get(I.targetRef);v?v.push(I):N.set(I.targetRef,[I])}return N}),q=N=>{h.value&&i.execute(N)},ce=(N,I,v)=>{const E=zt(N,I,v),C=yn(o.logical,N,B=>B.map(oe=>oe.modelId===I?{...oe,...v}:oe)),D=bn(C,N);q(D.length?Be("속성 수정",[E,...D]):E)};function Ee(N){const I=N.map(ie=>o.layout.entityLayouts.find(le=>le.entityRef===ie)).filter(ie=>!!ie);if(!I.length)return{location:{x:40,y:40},size:{width:400,height:300}};let v=1/0,E=1/0,C=-1/0,D=-1/0;for(const ie of I){const le=ie.geo.size.width||220,V=ie.geo.size.height||140;v=Math.min(v,ie.geo.location.x),E=Math.min(E,ie.geo.location.y),C=Math.max(C,ie.geo.location.x+le),D=Math.max(D,ie.geo.location.y+V)}const B=40,oe=28;return{location:{x:v-B,y:E-B-oe},size:{width:C-v+B*2,height:D-E+B*2+oe}}}function $e(N,I,v){var ie;const E=o.layout.groupLayouts.find(le=>le.groupRef===N),C=(E==null?void 0:E.geo.location)??I,D=I.x-C.x,B=I.y-C.y,oe=[Ha(N,I),...v.map(le=>an(le.id,le.location))];if(D||B){const le=new Set(((ie=o.logical.groups.find(V=>V.modelId===N))==null?void 0:ie.memberEntityRefs)??[]);for(const V of o.logical.associations){if(!le.has(V.end1.entityRef)||!le.has(V.end2.entityRef))continue;const M=o.layout.associationLayouts.find(y=>y.associationRef===V.modelId);M&&M.waypoints.length&&oe.push(er(V.modelId,D,B))}for(const V of(E==null?void 0:E.memberNoteRefs)??[]){const M=o.layout.notes.find(y=>y.modelId===V);M&&oe.push(Cn(V,{x:M.geo.location.x+D,y:M.geo.location.y+B}))}}return oe}return{state:o,resolved:Q,issues:pe,issuesByRef:de,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:g,dirty:_,editable:h,schemaVersion:k,opWriteEnabled:b,opMode:$,opConflict:R,displayMode:S,routingMode:X,showGrid:W,showMinimap:J,selection:T,selectedAttr:ee,selectedAttrIds:F,inspectedEntityId:K,focusRequest:O,clipboard:w,embeddableCatalog:l,groupCodeCatalog:a,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(N){h.value=N&&$.value},setEmbeddableCatalog(N){l.value=N},setGroupCodeCatalog(N){a.value=N},setPredefinedCustomTypeCatalog(N){r.value=N},selectAttribute(N,I,v="replace"){const E=T.value,C=(E==null?void 0:E.kind)==="attribute"&&E.entityId===N;if(v==="replace"||!C){T.value={kind:"attribute",entityId:N,ids:[I],anchor:I};return}if(v==="toggle"){const M=E.ids.includes(I),y=M?E.ids.filter(ae=>ae!==I):[...E.ids,I];if(!y.length){T.value=null;return}const L=M&&E.anchor===I?y[y.length-1]:M?E.anchor:I;T.value={kind:"attribute",entityId:N,ids:y,anchor:L};return}const D=o.logical.entities.find(M=>M.modelId===N),B=[...(D==null?void 0:D.attributes)??[]].sort((M,y)=>M.order-y.order).map(M=>M.modelId),oe=B.indexOf(E.anchor),ie=B.indexOf(I);if(oe<0||ie<0){T.value={kind:"attribute",entityId:N,ids:[I],anchor:I};return}const[le,V]=oe<=ie?[oe,ie]:[ie,oe];T.value={kind:"attribute",entityId:N,ids:B.slice(le,V+1),anchor:E.anchor}},moveAttributeFocus(N){const I=T.value;if((I==null?void 0:I.kind)!=="attribute")return!1;const v=o.logical.entities.find(B=>B.modelId===I.entityId);if(!v||!v.attributes.length)return!1;const E=v.attributes.findIndex(B=>B.modelId===I.anchor);if(E<0)return!1;const C=Math.min(Math.max(E+N,0),v.attributes.length-1);if(C===E)return!0;const D=v.attributes[C].modelId;return T.value={kind:"attribute",entityId:I.entityId,ids:[D],anchor:D},!0},nudgeSelectedAttributes(N){const I=T.value;if((I==null?void 0:I.kind)!=="attribute")return!1;const v=o.logical.entities.find(M=>M.modelId===I.entityId);if(!v)return!1;const E=v.attributes,C=new Set(I.ids),D=E.map((M,y)=>C.has(M.modelId)?y:-1).filter(M=>M>=0);if(!D.length)return!1;const B=Math.min(...D),oe=E.filter(M=>!C.has(M.modelId)),ie=E.slice(0,B).filter(M=>!C.has(M.modelId)).length;let le;if(N<0){if(ie<=0)return!0;le=ie-1}else{if(oe.length-ie<=0)return!0;le=ie+1}const V=E.filter(M=>C.has(M.modelId)).map(M=>M.modelId);return q(Qi(I.entityId,V,le)),!0},deleteSelection(){if(!h.value)return!1;const N=T.value;if(!N)return!1;if(N.kind==="attribute"){const I=N.ids;if(!I.length)return!1;I.length===1?q(It(N.entityId,I[0])):q(Be("속성 삭제",I.map(v=>It(N.entityId,v))))}else N.kind==="entity"?q(Xi(N.id)):N.kind==="note"?q(nl(N.id)):N.kind==="group"?q(Ji(N.id)):q(tl(N.id));return T.value=null,!0},nudgeNodes(N,I,v){if(!N.length||I===0&&v===0)return!1;const E=new Set(o.logical.entities.map(le=>le.modelId)),C=new Set(o.logical.groups.map(le=>le.modelId)),D=new Set(o.layout.notes.map(le=>le.modelId)),B=new Set;for(const le of N){if(!C.has(le))continue;const V=o.logical.groups.find(M=>M.modelId===le);for(const M of(V==null?void 0:V.memberEntityRefs)??[])B.add(M)}const oe=[],ie=[];for(const le of N)if(C.has(le)){const V=o.layout.groupLayouts.find(ae=>ae.groupRef===le);if(!V)continue;const M=o.logical.groups.find(ae=>ae.modelId===le),y=((M==null?void 0:M.memberEntityRefs)??[]).map(ae=>{var ge;const ue=((ge=o.layout.entityLayouts.find(P=>P.entityRef===ae))==null?void 0:ge.geo.location)??{x:0,y:0};return{id:ae,location:{x:ue.x+I,y:ue.y+v}}}),L={x:V.geo.location.x+I,y:V.geo.location.y+v};oe.push(Be("그룹 이동",$e(le,L,y))),ie.push("g:"+le)}else if(E.has(le)){if(B.has(le))continue;const V=o.layout.entityLayouts.find(M=>M.entityRef===le);if(!V)continue;oe.push(an(le,{x:V.geo.location.x+I,y:V.geo.location.y+v})),ie.push("e:"+le)}else if(D.has(le)){const V=o.layout.notes.find(M=>M.modelId===le);if(!V)continue;oe.push(Cn(le,{x:V.geo.location.x+I,y:V.geo.location.y+v})),ie.push("n:"+le)}return oe.length?(q(Be("이동",oe,"nudge:"+ie.sort().join(","))),!0):!1},requestFocus(N){O.value={id:N,nonce:++fe}},undo:()=>{h.value&&i.undo()},redo:()=>{h.value&&i.redo()},markSaved:()=>{h.value&&(H==null||H.flush(),i.markSavePoint())},loadDiagram(N,I){A(),o.logical=N.logical,o.layout=N.layout,i=new Wi(o),G(),k.value=(I==null?void 0:I.schemaVersion)??1,b.value=(I==null?void 0:I.opWriteEnabled)??!1,h.value=!(k.value>=2&&b.value===!1),x=I,R.value=null,T.value=null,m.value=i.canUndo,g.value=i.canRedo,_.value=i.isDirty,U()},flush(){H==null||H.flush()},whenOpsSettled(){return(H==null?void 0:H.whenSettled())??Promise.resolve()},addEntity(N="NewEntity",I={x:80,y:80}){const v=Se(),E={modelId:v,name:N,stereotype:"JPA_ENTITY",table:{physicalName:N.toLowerCase()},attributes:[{modelId:Se(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Se(),physicalName:"id",dataType:"BIGINT"}]}]};return q(Ki(E,{location:{...I},size:{width:220,height:140}})),v},renameEntity(N,I){q(Da(N,I))},updateEntity(N,I){const v=Ba(N,I),E=o.logical.entities.find(B=>B.modelId===N),C=I.stereotype==="JPA_EMBEDDABLE"&&!!E&&E.stereotype!=="JPA_EMBEDDABLE",D=!!I.stereotype&&I.stereotype!=="JPA_EMBEDDABLE"&&!!E&&E.stereotype==="JPA_EMBEDDABLE";if(C&&E){const B=E.attributes.filter(M=>M.identifier&&!M.derivedFrom).map(M=>zt(N,M.modelId,{identifier:!1})),oe=yn({...o.logical,entities:o.logical.entities.map(M=>M.modelId===N?{...M,stereotype:"JPA_EMBEDDABLE"}:M)},N,M=>M.map(y=>y.identifier&&!y.derivedFrom?{...y,identifier:!1}:y)),ie=Wl(oe,N),le=wb(o.logical,N),V=[v,...B,...ie,...le];q(V.length>1?Be("임베더블 변환",V):v);return}if(D){const B=vb(o.logical,N),oe=[v,...B];q(oe.length>1?Be("엔터티 전환",oe):v);return}q(v)},moveEntity(N,I){q(an(N,I))},resizeEntity(N,I){q(Oa(N,I))},removeEntity(N){q(Xi(N))},setEntitySwatch(N,I){q(La(N,I))},setEntityCollapsed(N,I){q(Pa(N,I))},collapseAll(){q(Zi(!0))},expandAll(){q(Zi(!1))},setAttributeSwatch(N,I,v){q(vo(N,I,v))},dragGroup(N,I,v){q(Be("그룹 이동",$e(N,I,v)))},resizeGroup(N,I){q(Fa(N,I))},updateGroup(N,I){q(za(N,I))},createGroup(N,I){if(!N.length)return null;const v=[];for(const D of o.logical.groups)for(const B of N)D.memberEntityRefs.includes(B)&&v.push(wo(D.modelId,B));const E=Se(),C={modelId:E,name:I?{ko:I}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...N]};return v.push(ji(C,Ee(N))),q(Be("그룹 생성",v)),T.value=null,E},addEmptyGroup(N,I){const v=Se();return q(ji({modelId:v,name:I?{ko:I}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...N},size:{width:360,height:260}})),v},removeGroup(N){q(Ji(N))},dropEntity(N,I,v){var D;const E=((D=o.logical.groups.find(B=>B.memberEntityRefs.includes(N)))==null?void 0:D.modelId)??null,C=[an(N,I)];E!==v&&(E&&C.push(wo(E,N)),v&&C.push(Ua(v,N))),q(Be("이동",C))},ungroupEntity(N){const I=o.logical.groups.find(v=>v.memberEntityRefs.includes(N));I&&q(wo(I.modelId,N))},dropNote(N,I,v){var D;const E=((D=o.layout.groupLayouts.find(B=>{var oe;return(oe=B.memberNoteRefs)==null?void 0:oe.includes(N)}))==null?void 0:D.groupRef)??null,C=[Cn(N,I)];E!==v&&(E&&C.push(rr(E,N)),v&&C.push(ar(v,N))),q(Be("이동",C))},addPredefinedEmbed(N,I){const v=l.value.find(ie=>ie.type===I),E=o.logical.entities.find(ie=>ie.modelId===N);if(!v||!E)return;const C=E.attributes.reduce((ie,le)=>Math.max(ie,le.order),-1)+1,D=Se(),B=v.fields.map(()=>({modelId:Se(),physicalName:"",dataType:""})),oe={modelId:D,name:v.defaultName,type:v.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:C,dbAttrs:B};return q(yt(N,oe)),D},addAttribute(N,I={}){const v=o.logical.entities.find(V=>V.modelId===N),E=v?v.attributes.length:0,C=I.modelId??Se(),D=I.name??`field${E}`,B={modelId:C,name:D,type:I.type??Sa,attrType:I.attrType??"NORMAL",identifier:I.identifier??!1,notNull:I.notNull??!1,order:E,dbAttrs:I.dbAttrs??[{modelId:Se(),physicalName:D,dataType:"VARCHAR",length:255}],...I},oe=yt(N,B),ie=yn(o.logical,N,V=>[...V,B]),le=bn(ie,N);return q(le.length?Be("속성 추가",[oe,...le]):oe),C},addDivider(N){const I=o.logical.entities.find(D=>D.modelId===N),v=I?I.attributes.length:0,E=Se();return q(yt(N,{modelId:E,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:v,dbAttrs:[]})),E},updateAttribute(N,I,v){ce(N,I,v)},setAttributeGroupCode(N,I,v){ce(N,I,{groupCode:v,type:v?yo:Sa})},setEmbedColumns(N,I,v){var ie,le;const E=zt(N,I,{dbAttrs:v}),C=(ie=o.logical.entities.find(V=>V.modelId===N))==null?void 0:ie.attributes.find(V=>V.modelId===I),D=(le=C==null?void 0:C.embedded)==null?void 0:le.associationRef,B=D?o.logical.associations.find(V=>V.modelId===D):void 0,oe=[];B&&D&&(B.end1.legacyEmbedRaw&&oe.push(rn(D,"end1",{legacyEmbedRaw:void 0})),B.end2.legacyEmbedRaw&&oe.push(rn(D,"end2",{legacyEmbedRaw:void 0}))),q(oe.length?Be("임베드 컬럼 수정",[E,...oe]):E)},removeAttribute(N,I){const v=It(N,I),E=yn(o.logical,N,D=>D.filter(B=>B.modelId!==I)),C=bn(E,N);q(C.length?Be("속성 삭제",[v,...C]):v)},removeAttributes(N,I){var B;if(!I.length)return;const v=I.map(oe=>It(N,oe)),E=new Set(I),C=yn(o.logical,N,oe=>oe.filter(ie=>!E.has(ie.modelId))),D=[...v,...bn(C,N)];q(D.length===1?D[0]:Be("속성 삭제",D)),((B=T.value)==null?void 0:B.kind)==="attribute"&&T.value.entityId===N&&(T.value=null)},setAttributeSwatches(N,I,v){I.length&&(I.length===1?q(vo(N,I[0],v)):q(Be("속성 색상",I.map(E=>vo(N,E,v)))))},reorderAttributes(N,I,v){I.length&&q(Qi(N,I,v))},addIndex(N,I){q(qa(N,I))},updateIndex(N,I,v){q(Za(N,I,v))},removeIndex(N,I){q(ja(N,I))},addOperation(N,I={}){var B;const v=o.logical.entities.find(oe=>oe.modelId===N),E=((B=v==null?void 0:v.operations)==null?void 0:B.length)??0,C=I.modelId??Se(),D={modelId:C,name:I.name??`method${E}`,visibility:I.visibility??"PACKAGE",order:E,...I};return q(Ga(N,D)),C},updateOperation(N,I,v){q(Ya(N,I,v))},removeOperation(N,I){q(Wa(N,I))},reorderOperations(N,I,v){I.length&&q(Ka(N,I,v))},setOperationSwatch(N,I,v){q(Xa(N,I,v))},addAssociation(N,I,v,E){const C=Se(),D={modelId:C,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:v},end2:{entityRef:I,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},B={...o.logical,associations:[...o.logical.associations,D]},oe=di(B,I,Se),ie=oe.add[0];ie&&(D.end2.attributeRef=ie.modelId);const le={associationRef:C,waypoints:[],sourceColumnRef:v,targetColumnRef:(ie==null?void 0:ie.modelId)??E},V=el(D,le),M=ui(I,oe);return q(M.length?Be("관계 추가",[V,...M]):V),C},addEmbedAssociation(N,I){const v=o.logical.entities.find(ge=>ge.modelId===N),E=o.logical.entities.find(ge=>ge.modelId===I);if(!v||!E||E.stereotype!=="JPA_EMBEDDABLE")return;const C=Se(),D=Se(),B=Se(),oe=v.attributes.reduce((ge,P)=>Math.max(ge,P.order),-1)+1,ie=Bc(E),le=ge=>ge&&ge.charAt(0).toLowerCase()+ge.slice(1),V=new Set(v.attributes.map(ge=>ge.name)),M=le(E.name);let y=M;for(let ge=2;V.has(y);ge++)y=`${M}${ge}`;const L={modelId:D,name:y,type:E.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:oe,dbAttrs:ie,embedded:{associationRef:C,embeddableRef:I}},ae={modelId:C,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:B},end2:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:D}},ue={associationRef:C,waypoints:[],sourceColumnRef:D,targetColumnRef:void 0};return q(Be("임베드 추가",[yt(N,L),el(ae,ue)])),C},setEmbedCollectionMode(N,I){const v=o.logical.associations.find(le=>le.modelId===N);if(!v)return;let E,C;for(const le of o.logical.entities){const V=le.attributes.find(M=>{var y;return((y=M.embedded)==null?void 0:y.associationRef)===N&&M.attrType==="EMBED_OWN"});if(V){E=le.modelId,C=V;break}}if(!E||!C)return;const D=C.embedded.embeddableRef,B=v.end2.entityRef===D?"end2":"end1",oe=v[B],ie=oe.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(I==="COLLECTION"?ie:!ie))if(I==="COLLECTION")q(Be("임베드 컬렉션 전환",[zt(E,C.modelId,{dbAttrs:[]}),rn(N,B,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...oe.jpa,collectionType:"LIST"}})]));else{const le=o.logical.entities.find(V=>V.modelId===D);if(!le)return;q(Be("임베드 단일 전환",[zt(E,C.modelId,{dbAttrs:Bc(le)}),rn(N,B,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...oe.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(N){const I=o.logical.associations.find(B=>B.modelId===N),v=tl(N);if(!I){q(v);return}for(const B of o.logical.entities){const oe=B.attributes.find(ie=>{var le;return((le=ie.embedded)==null?void 0:le.associationRef)===N});if(oe){q(Be("임베드 삭제",[v,It(B.modelId,oe.modelId)]));return}}const E=I.end2.entityRef,C={...o.logical,associations:o.logical.associations.filter(B=>B.modelId!==N)},D=Wl(C,E);q(D.length?Be("관계 삭제",[v,...D]):v)},setAssociationIdentifying(N,I){const v=o.logical.associations.find(oe=>oe.modelId===N),E=Eo(N,{identifying:I});if(!v||v.identifying===I){q(E);return}const C=v.end2.entityRef,D={...o.logical,associations:o.logical.associations.map(oe=>oe.modelId===N?{...oe,identifying:I}:oe)},B=Wl(D,C);q(B.length?Be("식별 관계 변경",[E,...B]):E)},updateAssociationEnd(N,I,v){q(rn(N,I,v))},moveWaypoint(N,I,v){q(Ja(N,I,v))},addWaypoint(N,I,v){q(nr(N,I,v))},removeWaypoint(N,I){q(Qa(N,I))},clearWaypoints(N){q(tr(N))},addNote(N="메모",I={x:80,y:80}){const v=Se();return q(or({modelId:v,memo:N,geo:{location:{...I},size:{width:200,height:120}}})),v},removeNote(N){q(nl(N))},moveNote(N,I){q(Cn(N,I))},resizeNote(N,I){q(ir(N,I))},setNoteMemo(N,I){q(lr(N,I))},addNoteConnection(N,I){q(sr(N,I))},removeNoteConnection(N,I){q(cr(N,I))},moveNoteConnectionWaypoint(N,I,v,E){q(dr(N,I,v,E))},addNoteConnectionWaypoint(N,I,v,E){q(ur(N,I,v,E))},removeNoteConnectionWaypoint(N,I,v){q(fr(N,I,v))},clearNoteConnectionWaypoints(N,I){q(mr(N,I))},autoLayout(){const N=Ea(o.logical,o.layout);N.length&&q(Be("자동 배치",N.map(I=>an(I.id,I.location))))},copy(){const N=T.value;if((N==null?void 0:N.kind)==="attribute"){const D=o.logical.entities.find(oe=>oe.modelId===N.entityId);if(!D)return;const B=[...D.attributes].sort((oe,ie)=>oe.order-ie.order).filter(oe=>N.ids.includes(oe.modelId));if(!B.length)return;w.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:B}));return}const I=K.value;if(!I)return;const v=o.logical.entities.find(D=>D.modelId===I),E=o.layout.entityLayouts.find(D=>D.entityRef===I);if(!v)return;const C=(E==null?void 0:E.geo)??{location:{x:80,y:80},size:{width:220,height:140}};w.value=JSON.parse(JSON.stringify({kind:"entity",entity:v,geo:C}))},paste(){if(!h.value)return;const N=w.value;if(!N)return;if(N.kind==="attribute"){const E=K.value;if(!E)return;const C=o.logical.entities.find(V=>V.modelId===E);if(!C)return;const D=new Set(C.attributes.map(V=>V.name)),B=new Set(C.attributes.flatMap(V=>V.dbAttrs.map(M=>M.physicalName))),oe=C.attributes.length,ie=[],le=N.attributes.map((V,M)=>{const y=JSON.parse(JSON.stringify(V));y.modelId=Se();for(const L of y.dbAttrs)L.modelId=Se();D.has(y.name)&&(y.name=`${y.name}_copy`);for(const L of y.dbAttrs)L.physicalName&&B.has(L.physicalName)&&(L.physicalName=`${L.physicalName}_copy`);return y.order=oe+M,ie.push(y.modelId),yt(E,y)});q(le.length===1?le[0]:Be("속성 붙여넣기",le)),T.value={kind:"attribute",entityId:E,ids:ie,anchor:ie[ie.length-1]};return}const I=_b(N.entity),v={location:{x:N.geo.location.x+40,y:N.geo.location.y+40},size:{...N.geo.size}};q(Ki(I,v)),T.value={kind:"entity",id:I.modelId}}}}const fi=Symbol("groupHover"),Dc=Symbol("groupDrag"),_n=Symbol("relationHighlight"),Nb={key:0,class:"em-sel","aria-hidden":"true"},kb=["title","aria-expanded","disabled"],xb={class:"em-entity__stereotype"},$b={key:1,class:"em-entity__name"},Ib=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Sb=["onPointerdown"],Cb={key:1,class:"em-entity__divider-label"},Rb=["title"],Vb={class:"em-key-slot"},Ab={class:"em-key-slot"},Tb={key:0,class:"em-entity__type"},Mb=["onClick"],Bb={class:"em-entity__attrname"},Db={class:"em-entity__type"},Ob=["data-op"],Lb=["onPointerdown"],Pb={class:"em-entity__op-vis","aria-hidden":"true"},zb=["title"],Ub={key:4,class:"em-entity__footer"},Oc=Ae(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(Jt,null),i=te.useModal();function l(){o&&si(i,o,t.id)}const a=n.inject(fi,null),r=n.inject(_n,null),s=n.computed(()=>!!o&&o.editable.value);function c(){a&&(a.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),p=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var j;return((j=o==null?void 0:o.selection.value)==null?void 0:j.kind)==="entity"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!m.value),_=n.computed(()=>{var j;return o&&((j=o.selectedAttr.value)==null?void 0:j.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),k=n.computed(()=>_.value.size>0);function b(j,ne){const se=ne.shiftKey?"range":ne.metaKey||ne.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,j.modelId,se)}const $=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),h=n.computed(()=>t.data.entity),S=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),X=n.computed(()=>t.data.collapsed??!1);function W(){s.value&&(o==null||o.setEntityCollapsed(t.id,!X.value))}const J=n.computed(()=>S.value==="PHYSICAL"||S.value==="LOGICAL_PHYSICAL"),T=n.computed(()=>{const j=S.value==="PHYSICAL"||S.value==="LOGICAL_PHYSICAL",ne={};for(const se of h.value.attributes){const be=se.attrType.startsWith("RELATION")&&se.dbAttrs.length>0;ne[se.modelId]={pk:se.identifier,fk:be&&j}}return ne});function ee(j){return j?j.pk&&j.fk?"PFK (식별 외래키)":j.pk?"PK (기본키)":j.fk?"FK (외래키)":"":""}const F=n.computed(()=>{const j=Fl(tt(t.data.style)),ne={};return j&&(ne["--em-header-bg"]=j.bar,ne["--em-header-fg"]=j.barOn),ne});function K(j){var ne,se;return(se=Fl(tt((ne=t.data.attributeStyles)==null?void 0:ne[j.modelId])))==null?void 0:se.text}const O=n.computed(()=>[...h.value.operations??[]].sort((j,ne)=>j.order-ne.order)),fe=n.computed(()=>S.value==="CLASS"&&O.value.length>0),w={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(j){return j?w[j]:"~"}function x(j){var ne,se;return(se=Fl(tt((ne=t.data.operationStyles)==null?void 0:ne[j.modelId])))==null?void 0:se.text}function G(j,ne,se){switch(S.value){case"CLASS":return[{text:j}];case"PHYSICAL":return[{text:se||j}];case"LOGICAL":return[ne?{text:ne}:{text:"(논리명)",missing:!0}];default:{const be=ne?{text:ne}:{text:"(논리명)",missing:!0};return se?[be,{text:` · ${se}`}]:[be]}}}function H(j){var ne,se,be;return Z(j)?[{text:j.name}]:G(j.name,(se=(ne=j.dbAttrs[0])==null?void 0:ne.logicalName)==null?void 0:se.ko,((be=j.dbAttrs[0])==null?void 0:be.physicalName)??"")}function Z(j){return j.attrType.startsWith("EMBED")&&j.dbAttrs.length>0}function A(j){return j.attrType==="DIVIDER"}function U(j){if(j.attrType!=="EMBED_PREDEF")return j.dbAttrs;const ne=o==null?void 0:o.embeddableCatalog.value.find(be=>be.type===j.type);if(!ne)return j.dbAttrs;const se=$n(h.value.attributes.flatMap(be=>be.dbAttrs));return j.dbAttrs.map((be,re)=>{const we=ne.fields[re],Ie=bo(be,se);return Ie?{...be,physicalName:Ie.physicalName,logicalName:be.logicalName??(we==null?void 0:we.logicalName),dataType:be.dataType||(we==null?void 0:we.dataType)||""}:we?{...be,physicalName:be.physicalName||we.physicalName,logicalName:be.logicalName??we.logicalName,dataType:be.dataType||we.dataType,length:be.length??we.length}:be})}function Q(j){var ne;return G(j.physicalName,(ne=j.logicalName)==null?void 0:ne.ko,j.physicalName)}function me(j){const ne=Va(j,(o==null?void 0:o.state.logical.associations)??[]);return Fi(S.value,j,ne)}const pe=n.computed(()=>{var j,ne,se;return G(h.value.name,(ne=(j=h.value.table)==null?void 0:j.logicalName)==null?void 0:ne.ko,((se=h.value.table)==null?void 0:se.physicalName)??"")}),de=n.ref(!1),q=n.ref(""),ce=n.ref(null);async function Ee(){var j,ne;s.value&&(q.value=h.value.name,de.value=!0,await n.nextTick(),(j=ce.value)==null||j.focus(),(ne=ce.value)==null||ne.select())}function $e(){if(!de.value)return;de.value=!1;const j=q.value.trim();j&&j!==h.value.name&&(o==null||o.renameEntity(t.id,j))}function ke(){o==null||o.addAttribute(t.id)}function he(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:N,findNode:I}=Ce(),v=n.ref(null),E=n.computed(()=>{const j=v.value??t.data.size;return j?{width:`${j.width}px`,height:`${j.height}px`}:void 0});let C=null;function D(j){var be,re,we;if(!s.value)return;j.stopPropagation();const ne=(be=I(t.id))==null?void 0:be.dimensions,se=N({x:j.clientX,y:j.clientY});C={fx:se.x,fy:se.y,w:(ne==null?void 0:ne.width)??((re=t.data.size)==null?void 0:re.width)??200,h:(ne==null?void 0:ne.height)??((we=t.data.size)==null?void 0:we.height)??120},j.target.setPointerCapture(j.pointerId)}function B(j){if(!C)return;const ne=N({x:j.clientX,y:j.clientY});v.value={width:Math.max(40,C.w+(ne.x-C.fx)),height:Math.max(40,C.h+(ne.y-C.fy))}}function oe(j){var ne,se,be;if(C&&v.value&&o){const re=(ne=I(t.id))==null?void 0:ne.dimensions;o.resizeEntity(t.id,{width:Math.round((re==null?void 0:re.width)??v.value.width),height:Math.round((re==null?void 0:re.height)??v.value.height)})}C=null,v.value=null,(be=(se=j.target).releasePointerCapture)==null||be.call(se,j.pointerId)}const ie=n.ref(null),le=n.ref(null);function V(j,ne){if(!s.value)return;ne.stopPropagation(),ne.preventDefault();const se=_.value,be=se.has(j.modelId)?new Set(se):new Set([j.modelId]);le.value={ids:be,dropIndex:-1,lineY:0},ne.target.setPointerCapture(ne.pointerId)}function M(j){if(!le.value||!ie.value)return;const ne=Array.from(ie.value.querySelectorAll(".em-entity__row"));if(!ne.length)return;let se=ne.length;for(let we=0;we<ne.length;we++){const Ie=ne[we].getBoundingClientRect();if(j.clientY<Ie.top+Ie.height/2){se=we;break}}const be=ne[ne.length-1],re=se<ne.length?ne[se].offsetTop:be.offsetTop+be.offsetHeight;le.value={...le.value,dropIndex:se,lineY:re}}function y(){const j=le.value;if(le.value=null,!j||j.dropIndex<0)return;const ne=h.value.attributes,se=ne.filter(Re=>j.ids.has(Re.modelId)).map(Re=>Re.modelId),be=ne.filter((Re,Ze)=>j.ids.has(Re.modelId)&&Ze<j.dropIndex).length,re=j.dropIndex-be,we=ne.filter(Re=>!j.ids.has(Re.modelId)).map(Re=>Re.modelId);[...we.slice(0,re),...se,...we.slice(re)].join(",")!==ne.map(Re=>Re.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,se,re))}function L(){le.value=null}const ae=n.ref(null),ue=n.ref(null);function ge(j,ne){s.value&&(ne.stopPropagation(),ne.preventDefault(),ue.value={id:j.modelId,dropIndex:-1,lineY:0},ne.target.setPointerCapture(ne.pointerId))}function P(j){if(!ue.value||!ae.value)return;const ne=Array.from(ae.value.querySelectorAll(".em-entity__op-row"));if(!ne.length)return;let se=ne.length;for(let we=0;we<ne.length;we++){const Ie=ne[we].getBoundingClientRect();if(j.clientY<Ie.top+Ie.height/2){se=we;break}}const be=ne[ne.length-1],re=se<ne.length?ne[se].offsetTop:be.offsetTop+be.offsetHeight;ue.value={...ue.value,dropIndex:se,lineY:re}}function Y(){const j=ue.value;if(ue.value=null,!j||j.dropIndex<0)return;const se=O.value.findIndex(re=>re.modelId===j.id);if(se<0)return;const be=j.dropIndex-(se<j.dropIndex?1:0);be!==se&&(o==null||o.reorderOperations(t.id,[j.id],be))}function z(){ue.value=null}return(j,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":$.value,"is-selected":m.value,"is-multi-selected":g.value,"has-focused-attr":k.value}]),style:n.normalizeStyle(E.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:l},[m.value?(n.openBlock(),n.createElementBlock("div",Nb,[...ne[7]||(ne[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(F.value),onDblclick:n.withModifiers(Ee,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:X.value?"펼치기":"접기","aria-expanded":!X.value,disabled:!s.value,onClick:n.withModifiers(W,["stop"]),onPointerdown:ne[0]||(ne[0]=n.withModifiers(()=>{},["stop"])),onDblclick:ne[1]||(ne[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(X.value?"▸":"▾"),41,kb),n.createElementVNode("span",xb,"«"+n.toDisplayString(h.value.stereotype)+"»",1),de.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ce,"onUpdate:modelValue":ne[2]||(ne[2]=se=>q.value=se),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys($e,["enter"]),ne[3]||(ne[3]=n.withKeys(se=>de.value=!1,["esc"]))],onBlur:$e,onPointerdown:ne[4]||(ne[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,q.value]]):(n.openBlock(),n.createElementBlock("span",$b,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.value,(se,be)=>(n.openBlock(),n.createElementBlock("span",{key:be,class:n.normalizeClass({"em-entity__missing":se.missing})},n.toDisplayString(se.text),3))),128))]))],36),X.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:ie,class:"em-entity__attrs"},[le.value&&le.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${le.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.attributes,se=>{var be,re,we;return n.openBlock(),n.createElementBlock(n.Fragment,{key:se.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":_.value.has(se.modelId),"is-dragging":(be=le.value)==null?void 0:be.ids.has(se.modelId),"is-embed":Z(se),"is-divider":A(se),nodrag:A(se)&&s.value}]),"data-attr":se.modelId,onClick:n.withModifiers(Ie=>b(se,Ie),["stop"]),onPointerdown:Ie=>A(se)?V(se,Ie):void 0,onPointermove:Ie=>A(se)?M(Ie):void 0,onPointerup:Ie=>A(se)?y():void 0,onPointercancel:Ie=>A(se)?L():void 0},[s.value&&!A(se)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ie=>V(se,Ie),onPointermove:M,onPointerup:y,onPointercancel:L,onClick:ne[5]||(ne[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Sb)):n.createCommentVNode("",!0),A(se)?(n.openBlock(),n.createElementBlock("span",Cb,n.toDisplayString(se.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(qt),{id:`l:${se.modelId}`,type:"target",position:n.unref(ve).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ee(T.value[se.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Vb,[(re=T.value[se.modelId])!=null&&re.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Ab,[Z(se)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(we=T.value[se.modelId])!=null&&we.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Rb),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:K(se)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H(se),(Ie,Re)=>(n.openBlock(),n.createElementBlock("span",{key:Re,class:n.normalizeClass({"em-entity__missing":Ie.missing})},n.toDisplayString(Ie.text),3))),128))],4),me(se)?(n.openBlock(),n.createElementBlock("span",Tb,n.toDisplayString(me(se)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(qt),{id:`r:${se.modelId}`,type:"source",position:n.unref(ve).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Ib),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Z(se)&&J.value?U(se):[],Ie=>(n.openBlock(),n.createElementBlock("li",{key:`${se.modelId}:${Ie.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":_.value.has(se.modelId)}]),onClick:n.withModifiers(Re=>b(se,Re),["stop"])},[ne[8]||(ne[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Bb,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Q(Ie),(Re,Ze)=>(n.openBlock(),n.createElementBlock("span",{key:Ze,class:n.normalizeClass({"em-entity__missing":Re.missing})},n.toDisplayString(Re.text),3))),128))]),n.createElementVNode("span",Db,n.toDisplayString(Ie.dataType),1)],10,Mb))),128))],64)}),128))],512)),!X.value&&fe.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:ae,class:"em-entity__ops"},[ue.value&&ue.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ue.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O.value,se=>{var be;return n.openBlock(),n.createElementBlock("li",{key:se.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((be=ue.value)==null?void 0:be.id)===se.modelId}]),"data-op":se.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:re=>ge(se,re),onPointermove:P,onPointerup:Y,onPointercancel:z,onClick:ne[6]||(ne[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Lb)):n.createCommentVNode("",!0),n.createElementVNode("span",Pb,n.toDisplayString(R(se.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:x(se)})},n.toDisplayString(se.name)+"()",5)],10,Ob)}),128))],512)):O.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${O.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(O.value.length)+"개",1)],8,zb)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Ub,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ke},"+ 속성"),ne[9]||(ne[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:he},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!de.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:D,onPointermove:B,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-1feee466"]]),Hb={key:0,class:"em-sel","aria-hidden":"true"},Fb={class:"em-group__label"},Gb={class:"em-group__name"},Yb={key:0,class:"em-group__pkg"},Wb={key:1,class:"em-group__flag"},Lc=Ae(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>tt(t.data.style)),l=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),a=n.inject(Jt,null),r=n.computed(()=>!!a&&a.editable.value),s=n.computed(()=>{var T;return!!t.id&&((T=a==null?void 0:a.selection.value)==null?void 0:T.kind)==="group"&&a.selection.value.id===t.id}),c=n.computed(()=>!!t.selected&&!s.value),d=n.inject(fi,null),u=n.computed(()=>!!t.id&&(d==null?void 0:d.value)===t.id),f=n.inject(_n,null);function p(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const g=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),_=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:k,findNode:b}=Ce();let $=null,h=null;function S(T){var K;if(!t.id||!r.value)return;T.stopPropagation();const ee=((K=b(t.id))==null?void 0:K.dimensions)??{width:400,height:300},F=k({x:T.clientX,y:T.clientY});$={fx:F.x,fy:F.y,w:ee.width,h:ee.height},T.target.setPointerCapture(T.pointerId)}function X(T){if(!$||!t.id)return;const ee=k({x:T.clientX,y:T.clientY});h={width:Math.max(160,$.w+(ee.x-$.fx)),height:Math.max(120,$.h+(ee.y-$.fy))};const F=b(t.id);F&&(F.style={width:`${h.width}px`,height:`${h.height}px`})}function W(T){var ee,F;$&&h&&t.id&&a&&a.resizeGroup(t.id,h),$=null,h=null,(F=(ee=T.target).releasePointerCapture)==null||F.call(ee,T.pointerId)}const J=n.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||"그룹"});return(T,ee)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":g.value,"is-dimmed":_.value,"is-selected":s.value,"is-multi-selected":c.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",Hb,[...ee[0]||(ee[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Fb,[n.createElementVNode("span",Gb,n.toDisplayString(J.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Yb,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Wb,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:S,onPointermove:X,onPointerup:W},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),Kb={key:0,class:"em-sel","aria-hidden":"true"},Xb={key:2,class:"em-note__text"},Pc=Ae(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(Jt,null),i=n.inject(fi,null),l=n.inject(_n,null),a=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value);function s(){i&&(i.value=t.data.groupRef??null)}function c(){l==null||l.setNoteHover(t.id)}function d(){l==null||l.setNoteHover(null)}const u=n.computed(()=>{var O;return((O=l==null?void 0:l.source.value)==null?void 0:O.kind)==="note"&&l.source.value.id===t.id}),f=n.computed(()=>!!l&&l.relatedNoteIds.value.has(t.id)&&!u.value),p=n.computed(()=>{var O;return((O=o==null?void 0:o.selection.value)==null?void 0:O.kind)==="note"&&o.selection.value.id===t.id}),m=n.computed(()=>!!t.selected&&!p.value),g=n.computed(()=>!!l&&l.active.value&&!l.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:ve.Top},{id:"n-right",pos:ve.Right},{id:"n-bottom",pos:ve.Bottom},{id:"n-left",pos:ve.Left}],k=n.ref(!1),b=n.ref(""),$=n.ref(null);async function h(){var O;r.value&&(b.value=a.value.memo,k.value=!0,await n.nextTick(),(O=$.value)==null||O.focus())}function S(){k.value&&(k.value=!1,b.value!==a.value.memo&&(o==null||o.setNoteMemo(t.id,b.value)))}const{screenToFlowCoordinate:X,findNode:W}=Ce();let J=null,T=null;function ee(O){var R;if(!r.value)return;O.stopPropagation();const fe=((R=W(t.id))==null?void 0:R.dimensions)??a.value.geo.size,w=X({x:O.clientX,y:O.clientY});J={fx:w.x,fy:w.y,w:fe.width,h:fe.height},O.target.setPointerCapture(O.pointerId)}function F(O){if(!J)return;const fe=X({x:O.clientX,y:O.clientY});T={width:Math.max(140,J.w+(fe.x-J.fx)),height:Math.max(60,J.h+(fe.y-J.fy))};const w=W(t.id);w&&(w.style={width:`${T.width}px`,height:`${T.height}px`})}function K(O){var fe,w;J&&T&&o&&o.resizeNote(t.id,T),J=null,T=null,(w=(fe=O.target).releasePointerCapture)==null||w.call(fe,O.pointerId)}return(O,fe)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":u.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":p.value,"is-multi-selected":m.value}]),onDblclick:h,onPointerdown:s,onMouseenter:c,onMouseleave:d},[p.value?(n.openBlock(),n.createElementBlock("div",Kb,[...fe[4]||(fe[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),k.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:$,"onUpdate:modelValue":fe[0]||(fe[0]=w=>b.value=w),class:"em-note__edit nodrag",onBlur:S,onKeydown:fe[1]||(fe[1]=n.withKeys(w=>k.value=!1,["esc"])),onPointerdown:fe[2]||(fe[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,b.value]]):(n.openBlock(),n.createElementBlock("div",Xb,n.toDisplayString(a.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,w=>n.createVNode(n.unref(qt),{id:w.id,key:w.id,type:"source",position:w.pos,class:"em-note-handle",onPointerdown:fe[3]||(fe[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!k.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ee,onPointermove:F,onPointerup:K},null,32)):n.createCommentVNode("",!0)],34))}}),[["__scopeId","data-v-07983822"]]),qb=20,Zb=22,jb=7,Jb=22,zc=31,Uc=7,Qb=20,Hc=11,Fc=11,e_=zc+Uc;function t_(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function n_(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function mi(e,t,o){const i=t.x-e.x,l=t.y-e.y,a=Math.hypot(i,l)||1;return{x:e.x+i*o/a,y:e.y+l*o/a}}function Gc(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function pi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Yc(e,t,o,i){const l=i/2,a=e.x===t.x&&e.y===t.y?Math.PI/2:Gc(e,t);return[pi(o,l,a-Math.PI/2),pi(o,l,a+Math.PI/2)]}function Wc(e,t,o,i){const l=t*180/Math.PI,r=(l>=0?i?l-20:l+20:i?l+20:l-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function Kc(e,t,o,i){const l=[],a=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:l,circles:a,polygons:r};if(i==="db"){const c=mi(e,t,qb),[d,u]=Yc(e,t,c,Zb);if(l.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),l.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),t_(o.multiplicity)){const f=mi(e,t,zc);a.push({cx:f.x,cy:f.y,r:Uc})}if(n_(o.multiplicity)){const f=mi(e,t,jb),[p,m]=Yc(e,t,f,Jb);l.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),l.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),l.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:l,circles:a,polygons:r}}let s=e;if(o.composition){const c=mi(e,t,Qb),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Gc(e,t),f=pi(d,Hc/2,u-Math.PI/2),p=pi(d,Hc/2,u+Math.PI/2);r.push({points:[e,f,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=Wc(s,c,Fc,!0),u=Wc(s,c,Fc,!1);l.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),l.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:l,circles:a,polygons:r}}const Xc=200,qc=120,Kl=24;function Zc(e){var l,a;if(!e)return{x:0,y:0,width:Xc,height:qc};const t=e.computedPosition??e.position??{x:0,y:0},o=((l=e.dimensions)==null?void 0:l.width)||Xc,i=((a=e.dimensions)==null?void 0:a.height)||qc;return{x:t.x,y:t.y,width:o,height:i}}function jc(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Jc(e){const t=n.computed(()=>Zc(e.sourceNode())),o=n.computed(()=>Zc(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),l=n.computed(()=>{var m,g;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,p=((g=e.targetRowY)==null?void 0:g.call(e))??d.y+d.height*2/3;if(Math.abs(p-f)<Kl){const _=(f+p)/2;f=_-Kl/2,p=_+Kl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),a=n.computed(()=>e.waypoints()[0]??jc(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??jc(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Pi(t.value,d,a.value.x):Li(t.value,a.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Pi(o.value,d,r.value.x):Li(o.value,r.value)});return{source:n.computed(()=>i.value?l.value.source:s.value.point),target:n.computed(()=>i.value?l.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Xl=Symbol("waypointController"),o_=["d"],i_=["d"],l_=["d"],a_=["x1","y1","x2","y2"],r_=["cx","cy","r"],s_=["x","y"],c_=["x","y"],d_=["cx","cy","onDblclick"],u_=["x","y","onPointerdown","onDblclick"],Qc=Ae(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ce(),i=n.inject(Xl),l=n.inject(Jt,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(Dc,null),s=n.inject(_n,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var he;return((he=l==null?void 0:l.selection.value)==null?void 0:he.kind)==="association"&&l.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const he=r==null?void 0:r.value;if(!he||!l)return null;const N=l.resolved.value.entities,I=E=>{var C;return(C=N.find(D=>D.entity.modelId===E))==null?void 0:C.groupRef},v=t.data.association;return I(v.end1.entityRef)===he.groupId&&I(v.end2.entityRef)===he.groupId?{dx:he.dx,dy:he.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),g=n.ref({x:0,y:0}),_=n.computed(()=>{const he=f.value;return p.value.map((N,I)=>I===m.value?g.value:he?{x:N.x+he.dx,y:N.y+he.dy}:N)}),k=n.computed(()=>{var he;return!!((he=t.sourceNode.data)!=null&&he.collapsed)}),b=n.computed(()=>{var he;return!!((he=t.targetNode.data)!=null&&he.collapsed)}),{source:$,target:h,sourceSide:S,targetSide:X,isSelf:W}=Jc({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>_.value,sourceRowY:()=>t.data.sourceColumnRef&&!k.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),J=e_+4,T=n.computed(()=>W.value?wa($.value,h.value):(l==null?void 0:l.routingMode.value)==="orthogonal"?Bi($.value,S.value,_.value,h.value,X.value,J):Oi($.value,_.value,h.value)),ee=n.computed(()=>W.value||!a.value?[]:(l==null?void 0:l.routingMode.value)==="orthogonal"?Di($.value,S.value,_.value,h.value,X.value,J):zi($.value,_.value,h.value).map((he,N)=>({point:he,segIndex:N}))),F=n.computed(()=>W.value||!a.value?[]:_.value);function K(he){switch(he){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 O(he,N){m.value=he,g.value={...p.value[he]},N.target.setPointerCapture(N.pointerId),N.stopPropagation()}function fe(he){if(m.value<0)return;const N=o({x:he.clientX,y:he.clientY});g.value={x:N.x,y:N.y}}function w(he){var N,I;m.value>=0&&i&&i.movePoint(t.id,m.value,{...g.value}),m.value=-1,(I=(N=he.target).releasePointerCapture)==null||I.call(N,he.pointerId)}function R(he,N){N.stopPropagation(),i==null||i.removePoint(t.id,he)}function x(he,N){if(!i)return;const I=o({x:N.clientX,y:N.clientY});i.insertPoint(t.id,he,{x:I.x,y:I.y})}const G=n.computed(()=>K(t.data.association.end1.multiplicity)),H=n.computed(()=>K(t.data.association.end2.multiplicity)),Z=n.computed(()=>(l==null?void 0:l.displayMode.value)==="CLASS"?"class":"db"),A=n.computed(()=>Z.value==="class"),U=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const he=kn(S.value);return{x:$.value.x+he.x*10,y:$.value.y+he.y*10}}return _.value[0]??h.value}),Q=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const N=kn(X.value);return{x:h.value.x+N.x*10,y:h.value.y+N.y*10}}const he=_.value;return he[he.length-1]??$.value}),me=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end1.multiplicity,navigable:he.end1.navigable,composition:he.end1.composition,otherNavigable:he.end2.navigable}}),pe=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end2.multiplicity,navigable:he.end2.navigable,composition:he.end2.composition,otherNavigable:he.end1.navigable}}),de=n.computed(()=>Kc($.value,U.value,me.value,Z.value)),q=n.computed(()=>Kc(h.value,Q.value,pe.value,Z.value)),ce=n.computed(()=>[...de.value.lines,...q.value.lines]),Ee=n.computed(()=>[...de.value.circles,...q.value.circles]),$e=n.computed(()=>[...de.value.polygons,...q.value.polygons].map(he=>`M${he.points.map(N=>`${N.x},${N.y}`).join(" L")} Z`)),ke=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(he,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:T.value,fill:"none",class:"em-edge__hit"},null,8,o_),n.createElementVNode("path",{d:T.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,i_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($e.value,(I,v)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${v}`,d:I,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",ke.value])},null,10,l_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.value,(I,v)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${v}`,x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,class:n.normalizeClass(["em-edge__marker",ke.value])},null,10,a_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ee.value,(I,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${v}`,cx:I.cx,cy:I.cy,r:I.r,class:n.normalizeClass(["em-edge__marker",ke.value])},null,10,r_))),128)),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref($).x+8,y:n.unref($).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(G.value),11,s_),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,c_)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ee.value,(I,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${v}`,cx:I.point.x,cy:I.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(E=>x(I.segIndex,E),["stop"])},null,42,d_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,(I,v)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${v}`,x:I.x-5,y:I.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:E=>O(v,E),onPointermove:fe,onPointerup:w,onDblclick:E=>R(v,E)},null,42,u_))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Nt=(e=>(e.Lines="lines",e.Dots="dots",e))(Nt||{});const ed=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},td=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Nt.Lines+"",Nt.Dots+"";const f_={[Nt.Dots]:"#81818a",[Nt.Lines]:"#eee"},m_=["id","x","y","width","height","patternTransform"],p_={key:2,height:"100",width:"100"},h_=["fill"],g_=["x","y","fill"],y_={name:"Background",compatConfig:{MODE:3}},b_=n.defineComponent({...y_,props:{id:{},variant:{default:()=>Nt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:o}=Ce(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,p*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),l=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),a=n.toRef(()=>e.color||e.patternColor||f_[e.variant||Nt.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:l.value},()=>[n.createElementVNode("pattern",{id:l.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(Nt).Lines?(n.openBlock(),n.createBlock(n.unref(ed),{key:0,size:r.lineWidth,color:a.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Nt).Dots?(n.openBlock(),n.createBlock(n.unref(td),{key:1,color:a.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",p_,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,h_)])):n.createCommentVNode("",!0)])],8,m_)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${l.value})`},null,8,g_),n.renderSlot(r.$slots,"default",{id:l.value})],4))}}),__={name:"ControlButton",compatConfig:{MODE:3}},v_=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},w_={type:"button",class:"vue-flow__controls-button"};function E_(e,t,o,i,l,a){return n.openBlock(),n.createElementBlock("button",w_,[n.renderSlot(e.$slots,"default")])}const hi=v_(__,[["render",E_]]),N_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},k_=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function x_(e,t){return n.openBlock(),n.createElementBlock("svg",N_,k_)}const $_={render:x_},I_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},S_=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function C_(e,t){return n.openBlock(),n.createElementBlock("svg",I_,S_)}const R_={render:C_},V_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},A_=[n.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function T_(e,t){return n.openBlock(),n.createElementBlock("svg",V_,A_)}const M_={render:T_},B_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},D_=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function O_(e,t){return n.openBlock(),n.createElementBlock("svg",B_,D_)}const L_={render:O_},P_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},z_=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function U_(e,t){return n.openBlock(),n.createElementBlock("svg",P_,z_)}const H_={render:U_},F_={name:"Controls",compatConfig:{MODE:3}},G_=n.defineComponent({...F_,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Is.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:l,setInteractive:a,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=Ce(),p=n.toRef(()=>o.value||i.value||l.value),m=n.toRef(()=>d.value.zoom<=u.value),g=n.toRef(()=>d.value.zoom>=f.value);function _(){r(),t("zoomIn")}function k(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function $(){a(!p.value),t("interactionChange",!p.value)}return(h,S)=>(n.openBlock(),n.createBlock(n.unref(xc),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(hi,{class:"vue-flow__controls-zoomin",disabled:g.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($_))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(hi,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:k},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(R_))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hi,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(M_))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(hi,{key:0,class:"vue-flow__controls-interactive",onClick:$},{default:n.withCtx(()=>[p.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(H_))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(L_))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Y_={value:()=>{}};function ql(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new gi(o)}function gi(e){this._=e}function W_(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}gi.prototype=ql.prototype={constructor:gi,on:function(e,t){var o=this._,i=W_(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=K_(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=nd(o[l],e.name,t);else if(t==null)for(l in o)o[l]=nd(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new gi(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function K_(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function nd(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=Y_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Zl="http://www.w3.org/1999/xhtml";const od={svg:"http://www.w3.org/2000/svg",xhtml:Zl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),od.hasOwnProperty(t)?{space:od[t],local:e}:e}function X_(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Zl&&t.documentElement.namespaceURI===Zl?t.createElement(e):t.createElementNS(o,e)}}function q_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function id(e){var t=yi(e);return(t.local?q_:X_)(t)}function Z_(){}function jl(e){return e==null?Z_:function(){return this.querySelector(e)}}function j_(e){typeof e!="function"&&(e=jl(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),c,d,u=0;u<r;++u)(c=a[u])&&(d=e.call(c,c.__data__,u,a))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new qe(i,this._parents)}function J_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Q_(){return[]}function ld(e){return e==null?Q_:function(){return this.querySelectorAll(e)}}function ev(e){return function(){return J_(e.apply(this,arguments))}}function tv(e){typeof e=="function"?e=ev(e):e=ld(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),l.push(c));return new qe(i,l)}function ad(e){return function(){return this.matches(e)}}function rd(e){return function(t){return t.matches(e)}}var nv=Array.prototype.find;function ov(e){return function(){return nv.call(this.children,e)}}function iv(){return this.firstElementChild}function lv(e){return this.select(e==null?iv:ov(typeof e=="function"?e:rd(e)))}var av=Array.prototype.filter;function rv(){return Array.from(this.children)}function sv(e){return function(){return av.call(this.children,e)}}function cv(e){return this.selectAll(e==null?rv:sv(typeof e=="function"?e:rd(e)))}function dv(e){typeof e!="function"&&(e=ad(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new qe(i,this._parents)}function sd(e){return new Array(e.length)}function uv(){return new qe(this._enter||this._groups.map(sd),this._parents)}function bi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bi.prototype={constructor:bi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fv(e){return function(){return e}}function mv(e,t,o,i,l,a){for(var r=0,s,c=t.length,d=a.length;r<d;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new bi(e,a[r]);for(;r<c;++r)(s=t[r])&&(l[r]=s)}function pv(e,t,o,i,l,a,r){var s,c,d=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?l[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(c=d.get(m))?(i[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new bi(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(l[s]=c)}function hv(e){return e.__data__}function gv(e,t){if(!arguments.length)return Array.from(this,hv);var o=t?pv:mv,i=this._parents,l=this._groups;typeof e!="function"&&(e=fv(e));for(var a=l.length,r=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var u=i[d],f=l[d],p=f.length,m=yv(e.call(u,u&&u.__data__,d,i)),g=m.length,_=s[d]=new Array(g),k=r[d]=new Array(g),b=c[d]=new Array(p);o(u,f,_,k,b,m,t);for(var $=0,h=0,S,X;$<g;++$)if(S=_[$]){for($>=h&&(h=$+1);!(X=k[h])&&++h<g;);S._next=X||null}}return r=new qe(r,i),r._enter=s,r._exit=c,r}function yv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bv(){return new qe(this._exit||this._groups.map(sd),this._parents)}function _v(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function vv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,g=0;g<f;++g)(m=d[g]||u[g])&&(p[g]=m);for(;c<l;++c)s[c]=o[c];return new qe(s,this._parents)}function wv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function Ev(e){e||(e=Nv);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,c=l[a]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new qe(l,this._parents).order()}function Nv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xv(){return Array.from(this)}function $v(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function Iv(){let e=0;for(const t of this)++e;return e}function Sv(){return!this.node()}function Cv(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function Rv(e){return function(){this.removeAttribute(e)}}function Vv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Av(e,t){return function(){this.setAttribute(e,t)}}function Tv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Bv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Dv(e,t){var o=yi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Vv:Rv:typeof t=="function"?o.local?Bv:Mv:o.local?Tv:Av)(o,t))}function cd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ov(e){return function(){this.style.removeProperty(e)}}function Lv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Pv(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function zv(e,t,o){return arguments.length>1?this.each((t==null?Ov:typeof t=="function"?Pv:Lv)(e,t,o??"")):vn(this.node(),e)}function vn(e,t){return e.style.getPropertyValue(t)||cd(e).getComputedStyle(e,null).getPropertyValue(t)}function Uv(e){return function(){delete this[e]}}function Hv(e,t){return function(){this[e]=t}}function Fv(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Gv(e,t){return arguments.length>1?this.each((t==null?Uv:typeof t=="function"?Fv:Hv)(e,t)):this.node()[e]}function dd(e){return e.trim().split(/^|\s+/)}function Jl(e){return e.classList||new ud(e)}function ud(e){this._node=e,this._names=dd(e.getAttribute("class")||"")}ud.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function fd(e,t){for(var o=Jl(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function md(e,t){for(var o=Jl(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function Yv(e){return function(){fd(this,e)}}function Wv(e){return function(){md(this,e)}}function Kv(e,t){return function(){(t.apply(this,arguments)?fd:md)(this,e)}}function Xv(e,t){var o=dd(e+"");if(arguments.length<2){for(var i=Jl(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?Kv:t?Yv:Wv)(o,t))}function qv(){this.textContent=""}function Zv(e){return function(){this.textContent=e}}function jv(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jv(e){return arguments.length?this.each(e==null?qv:(typeof e=="function"?jv:Zv)(e)):this.node().textContent}function Qv(){this.innerHTML=""}function ew(e){return function(){this.innerHTML=e}}function tw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nw(e){return arguments.length?this.each(e==null?Qv:(typeof e=="function"?tw:ew)(e)):this.node().innerHTML}function ow(){this.nextSibling&&this.parentNode.appendChild(this)}function iw(){return this.each(ow)}function lw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function aw(){return this.each(lw)}function rw(e){var t=typeof e=="function"?e:id(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function sw(){return null}function cw(e,t){var o=typeof e=="function"?e:id(e),i=t==null?sw:typeof t=="function"?t:jl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function dw(){var e=this.parentNode;e&&e.removeChild(this)}function uw(){return this.each(dw)}function fw(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mw(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pw(e){return this.select(e?mw:fw)}function hw(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gw(e){return function(t){e.call(this,t,this.__data__)}}function yw(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function bw(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function _w(e,t,o){return function(){var i=this.__on,l,a=gw(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function vw(e,t,o){var i=yw(e+""),l,a=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(l=0,u=s[c];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?_w:bw,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function pd(e,t,o){var i=cd(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function ww(e,t){return function(){return pd(this,e,t)}}function Ew(e,t){return function(){return pd(this,e,t.apply(this,arguments))}}function Nw(e,t){return this.each((typeof t=="function"?Ew:ww)(e,t))}function*kw(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var hd=[null];function qe(e,t){this._groups=e,this._parents=t}function jn(){return new qe([[document.documentElement]],hd)}function xw(){return this}qe.prototype=jn.prototype={constructor:qe,select:j_,selectAll:tv,selectChild:lv,selectChildren:cv,filter:dv,data:gv,enter:uv,exit:bv,join:_v,merge:vv,selection:xw,order:wv,sort:Ev,call:kv,nodes:xv,node:$v,size:Iv,empty:Sv,each:Cv,attr:Dv,style:zv,property:Gv,classed:Xv,text:Jv,html:nw,raise:iw,lower:aw,append:rw,insert:cw,remove:uw,clone:pw,datum:hw,on:vw,dispatch:Nw,[Symbol.iterator]:kw};function Mt(e){return typeof e=="string"?new qe([[document.querySelector(e)]],[document.documentElement]):new qe([[e]],hd)}function $w(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Bt(e,t){if(e=$w(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ql={capture:!0,passive:!1};function ea(e){e.preventDefault(),e.stopImmediatePropagation()}function Iw(e){var t=e.document.documentElement,o=Mt(e).on("dragstart.drag",ea,Ql);"onselectstart"in t?o.on("selectstart.drag",ea,Ql):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Sw(e,t){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);t&&(i.on("click.drag",ea,Ql),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 ta(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function gd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Jn(){}var Qn=.7,_i=1/Qn,wn="\\s*([+-]?\\d+)\\s*",eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Cw=/^#([0-9a-f]{3,8})$/,Rw=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Vw=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Aw=new RegExp(`^rgba\\(${wn},${wn},${wn},${eo}\\)$`),Tw=new RegExp(`^rgba\\(${pt},${pt},${pt},${eo}\\)$`),Mw=new RegExp(`^hsl\\(${eo},${pt},${pt}\\)$`),Bw=new RegExp(`^hsla\\(${eo},${pt},${pt},${eo}\\)$`),yd={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};ta(Jn,to,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bd,formatHex:bd,formatHex8:Dw,formatHsl:Ow,formatRgb:_d,toString:_d});function bd(){return this.rgb().formatHex()}function Dw(){return this.rgb().formatHex8()}function Ow(){return kd(this).formatHsl()}function _d(){return this.rgb().formatRgb()}function to(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Cw.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?vd(t):o===3?new We(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?vi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?vi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Rw.exec(e))?new We(t[1],t[2],t[3],1):(t=Vw.exec(e))?new We(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Aw.exec(e))?vi(t[1],t[2],t[3],t[4]):(t=Tw.exec(e))?vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Mw.exec(e))?Nd(t[1],t[2]/100,t[3]/100,1):(t=Bw.exec(e))?Nd(t[1],t[2]/100,t[3]/100,t[4]):yd.hasOwnProperty(e)?vd(yd[e]):e==="transparent"?new We(NaN,NaN,NaN,0):null}function vd(e){return new We(e>>16&255,e>>8&255,e&255,1)}function vi(e,t,o,i){return i<=0&&(e=t=o=NaN),new We(e,t,o,i)}function Lw(e){return e instanceof Jn||(e=to(e)),e?(e=e.rgb(),new We(e.r,e.g,e.b,e.opacity)):new We}function na(e,t,o,i){return arguments.length===1?Lw(e):new We(e,t,o,i??1)}function We(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}ta(We,na,gd(Jn,{brighter(e){return e=e==null?_i:Math.pow(_i,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qn:Math.pow(Qn,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new We(Qt(this.r),Qt(this.g),Qt(this.b),wi(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:wd,formatHex:wd,formatHex8:Pw,formatRgb:Ed,toString:Ed}));function wd(){return`#${en(this.r)}${en(this.g)}${en(this.b)}`}function Pw(){return`#${en(this.r)}${en(this.g)}${en(this.b)}${en((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ed(){const e=wi(this.opacity);return`${e===1?"rgb(":"rgba("}${Qt(this.r)}, ${Qt(this.g)}, ${Qt(this.b)}${e===1?")":`, ${e})`}`}function wi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Qt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function en(e){return e=Qt(e),(e<16?"0":"")+e.toString(16)}function Nd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,o,i)}function kd(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof Jn||(e=to(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,c=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?a+l:2-a-l,r*=60):s=c>0&&c<1?0:r,new nt(r,s,c,e.opacity)}function zw(e,t,o,i){return arguments.length===1?kd(e):new nt(e,t,o,i??1)}function nt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}ta(nt,zw,gd(Jn,{brighter(e){return e=e==null?_i:Math.pow(_i,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qn:Math.pow(Qn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new We(oa(e>=240?e-240:e+120,l,i),oa(e,l,i),oa(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new nt(xd(this.h),Ei(this.s),Ei(this.l),wi(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=wi(this.opacity);return`${e===1?"hsl(":"hsla("}${xd(this.h)}, ${Ei(this.s)*100}%, ${Ei(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xd(e){return e=(e||0)%360,e<0?e+360:e}function Ei(e){return Math.max(0,Math.min(1,e||0))}function oa(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const $d=e=>()=>e;function Uw(e,t){return function(o){return e+o*t}}function Hw(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Fw(e){return(e=+e)==1?Id:function(t,o){return o-t?Hw(t,o,e):$d(isNaN(t)?o:t)}}function Id(e,t){var o=t-e;return o?Uw(e,o):$d(isNaN(e)?t:e)}const Sd=(function e(t){var o=Fw(t);function i(l,a){var r=o((l=na(l)).r,(a=na(a)).r),s=o(l.g,a.g),c=o(l.b,a.b),d=Id(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=c(u),l.opacity=d(u),l+""}}return i.gamma=e,i})(1);function Dt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var ia=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,la=new RegExp(ia.source,"g");function Gw(e){return function(){return e}}function Yw(e){return function(t){return e(t)+""}}function Ww(e,t){var o=ia.lastIndex=la.lastIndex=0,i,l,a,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=ia.exec(e))&&(l=la.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,c.push({i:r,x:Dt(i,l)})),o=la.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?c[0]?Yw(c[0].x):Gw(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}var Cd=180/Math.PI,aa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Rd(e,t,o,i,l,a){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*Cd,skewX:Math.atan(c)*Cd,scaleX:r,scaleY:s}}var Ni;function Kw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?aa:Rd(t.a,t.b,t.c,t.d,t.e,t.f)}function Xw(e){return e==null||(Ni||(Ni=document.createElementNS("http://www.w3.org/2000/svg","g")),Ni.setAttribute("transform",e),!(e=Ni.transform.baseVal.consolidate()))?aa:(e=e.matrix,Rd(e.a,e.b,e.c,e.d,e.e,e.f))}function Vd(e,t,o,i){function l(d){return d.length?d.pop()+" ":""}function a(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);g.push({i:_-4,x:Dt(d,f)},{i:_-2,x:Dt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:Dt(d,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:Dt(d,u)}):u&&f.push(l(f)+"skewX("+u+i)}function c(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push(l(m)+"scale(",null,",",null,")");g.push({i:_-4,x:Dt(d,f)},{i:_-2,x:Dt(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),a(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var g=-1,_=p.length,k;++g<_;)f[(k=p[g]).i]=k.x(m);return f.join("")}}}var qw=Vd(Kw,"px, ","px)","deg)"),Zw=Vd(Xw,", ",")",")"),jw=1e-12;function Ad(e){return((e=Math.exp(e))+1/e)/2}function Jw(e){return((e=Math.exp(e))-1/e)/2}function Qw(e){return((e=Math.exp(2*e))-1)/(e+1)}const eE=(function e(t,o,i){function l(a,r){var s=a[0],c=a[1],d=a[2],u=r[0],f=r[1],p=r[2],m=u-s,g=f-c,_=m*m+g*g,k,b;if(_<jw)b=Math.log(p/d)/t,k=function(J){return[s+J*m,c+J*g,d*Math.exp(t*J*b)]};else{var $=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*$),S=(p*p-d*d-i*_)/(2*p*o*$),X=Math.log(Math.sqrt(h*h+1)-h),W=Math.log(Math.sqrt(S*S+1)-S);b=(W-X)/t,k=function(J){var T=J*b,ee=Ad(X),F=d/(o*$)*(ee*Qw(t*T+X)-Jw(X));return[s+F*m,c+F*g,d*ee/Ad(t*T+X)]}}return k.duration=b*1e3*t/Math.SQRT2,k}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,c=s*s;return e(r,s,c)},l})(Math.SQRT2,2,4);var En=0,no=0,oo=0,Td=1e3,ki,io,xi=0,tn=0,$i=0,lo=typeof performance=="object"&&performance.now?performance:Date,Md=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ra(){return tn||(Md(tE),tn=lo.now()+$i)}function tE(){tn=0}function Ii(){this._call=this._time=this._next=null}Ii.prototype=Bd.prototype={constructor:Ii,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ra():+o)+(t==null?0:+t),!this._next&&io!==this&&(io?io._next=this:ki=this,io=this),this._call=e,this._time=o,sa()},stop:function(){this._call&&(this._call=null,this._time=1/0,sa())}};function Bd(e,t,o){var i=new Ii;return i.restart(e,t,o),i}function nE(){ra(),++En;for(var e=ki,t;e;)(t=tn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--En}function Dd(){tn=(xi=lo.now())+$i,En=no=0;try{nE()}finally{En=0,iE(),tn=0}}function oE(){var e=lo.now(),t=e-xi;t>Td&&($i-=t,xi=e)}function iE(){for(var e,t=ki,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:ki=o);io=e,sa(i)}function sa(e){if(!En){no&&(no=clearTimeout(no));var t=e-tn;t>24?(e<1/0&&(no=setTimeout(Dd,e-lo.now()-$i)),oo&&(oo=clearInterval(oo))):(oo||(xi=lo.now(),oo=setInterval(oE,Td)),En=1,Md(Dd))}}function Od(e,t,o){var i=new Ii;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var lE=ql("start","end","cancel","interrupt"),aE=[],Ld=0,Pd=1,ca=2,Si=3,zd=4,da=5,Ci=6;function Ri(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;rE(e,o,{name:t,index:i,group:l,on:lE,tween:aE,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Ld})}function ua(e,t){var o=ot(e,t);if(o.state>Ld)throw new Error("too late; already scheduled");return o}function ht(e,t){var o=ot(e,t);if(o.state>Si)throw new Error("too late; already running");return o}function ot(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function rE(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=Bd(a,0,o.time);function a(d){o.state=Pd,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==Pd)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Si)return Od(r);m.state===zd?(m.state=Ci,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Ci,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Od(function(){o.state===Si&&(o.state=zd,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ca,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ca){for(o.state=Si,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=da,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===da&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ci,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Vi(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>ca&&i.state<da,i.state=Ci,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function sE(e){return this.each(function(){Vi(this,e)})}function cE(e,t){var o,i;return function(){var l=ht(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function dE(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=ht(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},c=0,d=l.length;c<d;++c)if(l[c].name===t){l[c]=s;break}c===d&&l.push(s)}a.tween=l}}function uE(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ot(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?cE:dE)(o,e,t))}function fa(e,t,o){var i=e._id;return e.each(function(){var l=ht(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return ot(l,i).value[t]}}function Ud(e,t){var o;return(typeof t=="number"?Dt:t instanceof to?Sd:(o=to(t))?(t=o,Sd):Ww)(e,t)}function fE(e){return function(){this.removeAttribute(e)}}function mE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pE(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function hE(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function gE(e,t,o){var i,l,a;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s)))}}function yE(e,t,o){var i,l,a;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s)))}}function bE(e,t){var o=yi(e),i=o==="transform"?Zw:Ud;return this.attrTween(e,typeof t=="function"?(o.local?yE:gE)(o,i,fa(this,"attr."+e,t)):t==null?(o.local?mE:fE)(o):(o.local?hE:pE)(o,i,t))}function _E(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function vE(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function wE(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&vE(e,a)),o}return l._value=t,l}function EE(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&_E(e,a)),o}return l._value=t,l}function NE(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=yi(e);return this.tween(o,(i.local?wE:EE)(i,t))}function kE(e,t){return function(){ua(this,e).delay=+t.apply(this,arguments)}}function xE(e,t){return t=+t,function(){ua(this,e).delay=t}}function $E(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kE:xE)(t,e)):ot(this.node(),t).delay}function IE(e,t){return function(){ht(this,e).duration=+t.apply(this,arguments)}}function SE(e,t){return t=+t,function(){ht(this,e).duration=t}}function CE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IE:SE)(t,e)):ot(this.node(),t).duration}function RE(e,t){if(typeof t!="function")throw new Error;return function(){ht(this,e).ease=t}}function VE(e){var t=this._id;return arguments.length?this.each(RE(t,e)):ot(this.node(),t).ease}function AE(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ht(this,e).ease=o}}function TE(e){if(typeof e!="function")throw new Error;return this.each(AE(this._id,e))}function ME(e){typeof e!="function"&&(e=ad(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new kt(i,this._parents,this._name,this._id)}function BE(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new kt(r,this._parents,this._name,this._id)}function DE(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function OE(e,t,o){var i,l,a=DE(t)?ua:ht;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function LE(e,t){var o=this._id;return arguments.length<2?ot(this.node(),o).on.on(e):this.each(OE(o,e,t))}function PE(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function zE(){return this.on("end.remove",PE(this._id))}function UE(e){var t=this._name,o=this._id;typeof e!="function"&&(e=jl(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],c=s.length,d=a[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Ri(d[p],t,o,p,d,ot(u,o)));return new kt(a,this._parents,t,o)}function HE(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ld(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,g=ot(u,o),_=0,k=p.length;_<k;++_)(m=p[_])&&Ri(m,t,o,_,p,g);a.push(p),r.push(u)}return new kt(a,r,t,o)}var FE=jn.prototype.constructor;function GE(){return new FE(this._groups,this._parents)}function YE(e,t){var o,i,l;return function(){var a=vn(this,e),r=(this.style.removeProperty(e),vn(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function Hd(e){return function(){this.style.removeProperty(e)}}function WE(e,t,o){var i,l=o+"",a;return function(){var r=vn(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function KE(e,t,o){var i,l,a;return function(){var r=vn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),vn(this,e))),r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s))}}function XE(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var c=ht(this,e),d=c.on,u=c.value[a]==null?s||(s=Hd(t)):void 0;(d!==o||l!==u)&&(i=(o=d).copy()).on(r,l=u),c.on=i}}function qE(e,t,o){var i=(e+="")=="transform"?qw:Ud;return t==null?this.styleTween(e,YE(e,i)).on("end.style."+e,Hd(e)):typeof t=="function"?this.styleTween(e,KE(e,i,fa(this,"style."+e,t))).each(XE(this._id,e)):this.styleTween(e,WE(e,i,t),o).on("end.style."+e,null)}function ZE(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function jE(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&ZE(e,r,o)),i}return a._value=t,a}function JE(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,jE(e,t,o??""))}function QE(e){return function(){this.textContent=e}}function eN(e){return function(){var t=e(this);this.textContent=t??""}}function tN(e){return this.tween("text",typeof e=="function"?eN(fa(this,"text",e)):QE(e==null?"":e+""))}function nN(e){return function(t){this.textContent=e.call(this,t)}}function oN(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&nN(l)),t}return i._value=e,i}function iN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oN(e))}function lN(){for(var e=this._name,t=this._id,o=Fd(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=ot(c,t);Ri(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new kt(i,this._parents,e,o)}function aN(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},c={value:function(){--l===0&&a()}};o.each(function(){var d=ht(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),l===0&&a()})}var rN=0;function kt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Fd(){return++rN}var xt=jn.prototype;kt.prototype={constructor:kt,select:UE,selectAll:HE,selectChild:xt.selectChild,selectChildren:xt.selectChildren,filter:ME,merge:BE,selection:GE,transition:lN,call:xt.call,nodes:xt.nodes,node:xt.node,size:xt.size,empty:xt.empty,each:xt.each,on:LE,attr:bE,attrTween:NE,style:qE,styleTween:JE,text:tN,textTween:iN,remove:zE,tween:uE,delay:$E,duration:CE,ease:VE,easeVarying:TE,end:aN,[Symbol.iterator]:xt[Symbol.iterator]};function sN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cN={time:null,delay:0,duration:250,ease:sN};function dN(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function uN(e){var t,o;e instanceof kt?(t=e._id,e=e._name):(t=Fd(),(o=cN).time=ra(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Ri(c,e,t,d,r,o||dN(c,t));return new kt(i,this._parents,e,t)}jn.prototype.interrupt=sE,jn.prototype.transition=uN;const Ai=e=>()=>e;function fN(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function $t(e,t,o){this.k=e,this.x=t,this.y=o}$t.prototype={constructor:$t,scale:function(e){return e===1?this:new $t(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $t(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ma=new $t(1,0,0);$t.prototype;function pa(e){e.stopImmediatePropagation()}function ao(e){e.preventDefault(),e.stopImmediatePropagation()}function mN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pN(){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 Gd(){return this.__zoom||ma}function hN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gN(){return navigator.maxTouchPoints||"ontouchstart"in this}function yN(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function bN(){var e=mN,t=pN,o=yN,i=hN,l=gN,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=eE,d=ql("start","zoom","end"),u,f,p,m=500,g=150,_=0,k=10;function b(w){w.property("__zoom",Gd).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ee).on("dblclick.zoom",F).filter(l).on("touchstart.zoom",K).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",fe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(w,R,x,G){var H=w.selection?w.selection():w;H.property("__zoom",Gd),w!==H?X(w,R,x,G):H.interrupt().each(function(){W(this,arguments).event(G).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(w,R,x,G){b.scaleTo(w,function(){var H=this.__zoom.k,Z=typeof R=="function"?R.apply(this,arguments):R;return H*Z},x,G)},b.scaleTo=function(w,R,x,G){b.transform(w,function(){var H=t.apply(this,arguments),Z=this.__zoom,A=x==null?S(H):typeof x=="function"?x.apply(this,arguments):x,U=Z.invert(A),Q=typeof R=="function"?R.apply(this,arguments):R;return o(h($(Z,Q),A,U),H,r)},x,G)},b.translateBy=function(w,R,x,G){b.transform(w,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof x=="function"?x.apply(this,arguments):x),t.apply(this,arguments),r)},null,G)},b.translateTo=function(w,R,x,G,H){b.transform(w,function(){var Z=t.apply(this,arguments),A=this.__zoom,U=G==null?S(Z):typeof G=="function"?G.apply(this,arguments):G;return o(ma.translate(U[0],U[1]).scale(A.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof x=="function"?-x.apply(this,arguments):-x),Z,r)},G,H)};function $(w,R){return R=Math.max(a[0],Math.min(a[1],R)),R===w.k?w:new $t(R,w.x,w.y)}function h(w,R,x){var G=R[0]-x[0]*w.k,H=R[1]-x[1]*w.k;return G===w.x&&H===w.y?w:new $t(w.k,G,H)}function S(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function X(w,R,x,G){w.on("start.zoom",function(){W(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){W(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,Z=arguments,A=W(H,Z).event(G),U=t.apply(H,Z),Q=x==null?S(U):typeof x=="function"?x.apply(H,Z):x,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),pe=H.__zoom,de=typeof R=="function"?R.apply(H,Z):R,q=c(pe.invert(Q).concat(me/pe.k),de.invert(Q).concat(me/de.k));return function(ce){if(ce===1)ce=de;else{var Ee=q(ce),$e=me/Ee[2];ce=new $t($e,Q[0]-Ee[0]*$e,Q[1]-Ee[1]*$e)}A.zoom(null,ce)}})}function W(w,R,x){return!x&&w.__zooming||new J(w,R)}function J(w,R){this.that=w,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,R),this.taps=0}J.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,R){return this.mouse&&w!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var R=Mt(this.that).datum();d.call(w,this.that,new fN(w,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),R)}};function T(w,...R){if(!e.apply(this,arguments))return;var x=W(this,R).event(w),G=this.__zoom,H=Math.max(a[0],Math.min(a[1],G.k*Math.pow(2,i.apply(this,arguments)))),Z=Bt(w);if(x.wheel)(x.mouse[0][0]!==Z[0]||x.mouse[0][1]!==Z[1])&&(x.mouse[1]=G.invert(x.mouse[0]=Z)),clearTimeout(x.wheel);else{if(G.k===H)return;x.mouse=[Z,G.invert(Z)],Vi(this),x.start()}ao(w),x.wheel=setTimeout(A,g),x.zoom("mouse",o(h($(G,H),x.mouse[0],x.mouse[1]),x.extent,r));function A(){x.wheel=null,x.end()}}function ee(w,...R){if(p||!e.apply(this,arguments))return;var x=w.currentTarget,G=W(this,R,!0).event(w),H=Mt(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",me,!0),Z=Bt(w,x),A=w.clientX,U=w.clientY;Iw(w.view),pa(w),G.mouse=[Z,this.__zoom.invert(Z)],Vi(this),G.start();function Q(pe){if(ao(pe),!G.moved){var de=pe.clientX-A,q=pe.clientY-U;G.moved=de*de+q*q>_}G.event(pe).zoom("mouse",o(h(G.that.__zoom,G.mouse[0]=Bt(pe,x),G.mouse[1]),G.extent,r))}function me(pe){H.on("mousemove.zoom mouseup.zoom",null),Sw(pe.view,G.moved),ao(pe),G.event(pe).end()}}function F(w,...R){if(e.apply(this,arguments)){var x=this.__zoom,G=Bt(w.changedTouches?w.changedTouches[0]:w,this),H=x.invert(G),Z=x.k*(w.shiftKey?.5:2),A=o(h($(x,Z),G,H),t.apply(this,R),r);ao(w),s>0?Mt(this).transition().duration(s).call(X,A,G,w):Mt(this).call(b.transform,A,G,w)}}function K(w,...R){if(e.apply(this,arguments)){var x=w.touches,G=x.length,H=W(this,R,w.changedTouches.length===G).event(w),Z,A,U,Q;for(pa(w),A=0;A<G;++A)U=x[A],Q=Bt(U,this),Q=[Q,this.__zoom.invert(Q),U.identifier],H.touch0?!H.touch1&&H.touch0[2]!==Q[2]&&(H.touch1=Q,H.taps=0):(H.touch0=Q,Z=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),Z&&(H.taps<2&&(f=Q[0],u=setTimeout(function(){u=null},m)),Vi(this),H.start())}}function O(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A,U,Q;for(ao(w),Z=0;Z<H;++Z)A=G[Z],U=Bt(A,this),x.touch0&&x.touch0[2]===A.identifier?x.touch0[0]=U:x.touch1&&x.touch1[2]===A.identifier&&(x.touch1[0]=U);if(A=x.that.__zoom,x.touch1){var me=x.touch0[0],pe=x.touch0[1],de=x.touch1[0],q=x.touch1[1],ce=(ce=de[0]-me[0])*ce+(ce=de[1]-me[1])*ce,Ee=(Ee=q[0]-pe[0])*Ee+(Ee=q[1]-pe[1])*Ee;A=$(A,Math.sqrt(ce/Ee)),U=[(me[0]+de[0])/2,(me[1]+de[1])/2],Q=[(pe[0]+q[0])/2,(pe[1]+q[1])/2]}else if(x.touch0)U=x.touch0[0],Q=x.touch0[1];else return;x.zoom("touch",o(h(A,U,Q),x.extent,r))}}function fe(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A;for(pa(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),Z=0;Z<H;++Z)A=G[Z],x.touch0&&x.touch0[2]===A.identifier?delete x.touch0:x.touch1&&x.touch1[2]===A.identifier&&delete x.touch1;if(x.touch1&&!x.touch0&&(x.touch0=x.touch1,delete x.touch1),x.touch0)x.touch0[1]=this.__zoom.invert(x.touch0[0]);else if(x.end(),x.taps===2&&(A=Bt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<k)){var U=Mt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ai(+w),b):i},b.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ai(!!w),b):e},b.touchable=function(w){return arguments.length?(l=typeof w=="function"?w:Ai(!!w),b):l},b.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ai([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),b):t},b.scaleExtent=function(w){return arguments.length?(a[0]=+w[0],a[1]=+w[1],b):[a[0],a[1]]},b.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(w){return arguments.length?(o=w,b):o},b.duration=function(w){return arguments.length?(s=+w,b):s},b.interpolate=function(w){return arguments.length?(c=w,b):c},b.on=function(){var w=d.on.apply(d,arguments);return w===d?b:w},b.clickDistance=function(w){return arguments.length?(_=(w=+w)*w,b):Math.sqrt(_)},b.tapDistance=function(w){return arguments.length?(k=+w,b):k},b}const Yd=Symbol("MiniMapSlots"),_N=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],vN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},wN=n.defineComponent({...vN,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(Yd),l=n.useAttrs(),a=n.toRef(()=>l.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,p)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||a.value.background||a.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,_N))],64)):n.createCommentVNode("",!0)}}),EN=["width","height","viewBox","aria-labelledby"],NN=["id"],kN=["d","fill","stroke","stroke-width"],xN={name:"MiniMap",compatConfig:{MODE:3}},$N=n.defineComponent({...xN,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),l=200,a=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:g}=Ce(),_=n.ref();n.provide(Yd,o);const k=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??l}),b=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??a}),$=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),S=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),X=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),W=n.computed(()=>Cl(g.value.filter(H=>!H.hidden))),J=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),T=n.computed(()=>g.value&&g.value.length?fg(W.value,J.value):J.value),ee=n.computed(()=>{const H=T.value.width/k.value,Z=T.value.height/b.value;return Math.max(H,Z)}),F=n.computed(()=>{const H=ee.value*k.value,Z=ee.value*b.value,A=e.offsetScale*ee.value;return{offset:A,x:T.value.x-(H-T.value.width)/2-A,y:T.value.y-(Z-T.value.height)/2-A,width:H+A*2,height:Z+A*2}}),K=n.computed(()=>!F.value.x||!F.value.y?"":`
28
- M${F.value.x-F.value.offset},${F.value.y-F.value.offset}
29
- h${F.value.width+F.value.offset*2}
30
- v${F.value.height+F.value.offset*2}
31
- h${-F.value.width-F.value.offset*2}z
32
- M${J.value.x+e.maskBorderRadius},${J.value.y}
33
- h${J.value.width-2*e.maskBorderRadius}
27
+ 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 qe extends Error{constructor(t,...o){var i;super((i=Oc[t])==null?void 0:i.call(Oc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function il(e){return"clientX"in e}function jg(e){return"sourceEvent"in e}function kt(e,t){const o=il(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const bo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Zg(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function ki(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Jg=()=>!0;function al(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Qg(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const l of t.values())bi(a,gi(l))>0&&i.push(l);return i}const eb=250;function tb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Qg(e,o,t+eb);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:p,y:m}=Mn(d,f,f.position,!0),h=Math.sqrt((p-e.x)**2+(m-e.y)**2);h>t||(h<s?(r=[{...f,x:p,y:m}],s=h):h===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function Lc(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Jg},u,f,p,m){const h=l==="target",b=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:g,y:_}=kt(e),N=r.elementFromPoint(g,_),y=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:b,$={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const K=Pc(void 0,y),F=y.getAttribute("data-nodeid"),q=y.getAttribute("data-handleid"),G=y.classList.contains("connectable"),X=y.classList.contains("connectableend");if(!F||!K)return $;const Q={source:h?F:i,sourceHandle:h?q:a,target:h?i:F,targetHandle:h?a:q};$.connection=Q;const B=G&&X&&(o===At.Strict?h&&K==="source"||!h&&K==="target":F!==i||q!==a);$.isValid=B&&d(Q,{nodes:f,edges:u,sourceNode:p(Q.source),targetNode:p(Q.target)}),$.toHandle=zc(F,K,q,m,o,!0)}return $}function Pc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function ob(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function zc(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===At.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...Mn(d,f,f.position,!0)}:f}const ll={[Ie.Left]:Ie.Right,[Ie.Right]:Ie.Left,[Ie.Top]:Ie.Bottom,[Ie.Bottom]:Ie.Top},ib=["production","prod"];function _o(e,...t){Uc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Uc(){return!ib.includes(process.env.NODE_ENV||"")}function Hc(e,t,o,i,a){const l=t.querySelectorAll(`.vue-flow__handle.${e}`);return l!=null&&l.length?Array.from(l).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:a,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,..._i(r)}}):null}function rl(e,t,o,i,a,l=!1,r){a.value=!1,e.selected?(l||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function Ye(e){return typeof n.unref(e)<"u"}function ab(e,t,o,i){if(!e||!e.source||!e.target)return o(new qe(Ge.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Ht(e)?a=e:a={...e,id:vc(e)},a=_c(a,void 0,i),Pg(a,t)?!1:a}function lb(e,t,o,i,a){if(!t.source||!t.target)return a(new qe(Ge.EDGE_INVALID,e.id)),!1;if(!o)return a(new qe(Ge.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?vc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Fc(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!cn(r)){o(new qe(Ge.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=Dg(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),a[l]=s}for(const l of a){const r=t(l.parentNode)||a.find(s=>s.id===l.parentNode);l.parentNode&&!r&&o(new qe(Ge.NODE_MISSING_PARENT,l.id,l.parentNode)),(l.parentNode||i[l.id])&&(i[l.id]&&(l.isParent=!0),r&&(r.isParent=!0))}return a}function Gc(e,t,o,i,a,l){let r=a;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${a}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),l){r=`${a}-${e}-${l}`;const d=i.get(r)||new Map;i.set(r,d.set(o,t))}}function sl(e,t,o){e.clear();for(const i of o){const{source:a,target:l,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:l,sourceHandle:r,targetHandle:s},d=`${a}-${r}--${l}-${s}`,u=`${l}-${s}--${a}-${r}`;Gc("source",c,u,e,a,r),Gc("target",c,d,e,l,s)}}function Yc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function cl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Ht(d)?d:ab(d,s,a,l);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){a(new qe(Ge.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new qe(Ge.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new qe(Ge.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){a(new qe(Ge.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({..._c(u,m,l),sourceNode:f,targetNode:p})}return c}const Wc=Symbol("vueFlow"),Kc=Symbol("nodeId"),qc=Symbol("nodeRef"),rb=Symbol("edgeId"),sb=Symbol("edgeRef"),Ei=Symbol("slots");function Xc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:h,nodesSelectionActive:b,selectNodesOnDrag:g,removeSelectedElements:_,addSelectedNodes:N,updateNodePositions:y,emits:$}=De(),{onStart:K,onDrag:F,onStop:q,onClick:G,el:X,disabled:Q,id:de,selectable:B,dragHandle:ee}=e,v=n.shallowRef(!1);let R=[],E,P=null,W={x:void 0,y:void 0},oe={x:0,y:0},T=null,J=!1,se=!1,he=0,we=!1;const re=ub(),me=({x:Y,y:C})=>{W={x:Y,y:C};let k=!1;if(R=R.map(V=>{const H={x:Y-V.distance.x,y:C-V.distance.y},{computedPosition:te}=ol(V,o.value?ki(H,i.value):H,$.error,r.value,V.parentNode?m(V.parentNode):void 0);return k=k||V.position.x!==te.x||V.position.y!==te.y,V.position=te,V}),se=se||k,!!k&&(y(R,!0,!0),v.value=!0,T)){const[V,H]=nl({id:de,dragItems:R,findNode:m});F({event:T,node:V,nodes:H})}},be=()=>{if(!P)return;const[Y,C]=Sc(oe,P,u.value);if(Y!==0||C!==0){const k={x:(W.x??0)-Y/c.value.zoom,y:(W.y??0)-C/c.value.zoom};p({x:Y,y:C})&&me(k)}he=requestAnimationFrame(be)},xe=(Y,C)=>{J=!0;const k=m(de);!g.value&&!h.value&&k&&(k.selected||_()),k&&n.toValue(B)&&g.value&&rl(k,h.value,N,_,b,!1,C);const V=re(Y.sourceEvent);if(W=V,R=Gg(l.value,f.value,V,de),R.length){const[H,te]=nl({id:de,dragItems:R,findNode:m});K({event:Y.sourceEvent,node:H,nodes:te})}},Ce=(Y,C)=>{var k;Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||(se=!1,s.value===0&&xe(Y,C),W=re(Y.sourceEvent),P=((k=t.value)==null?void 0:k.getBoundingClientRect())||null,oe=kt(Y.sourceEvent,P))},Se=(Y,C)=>{const k=re(Y.sourceEvent);if(!we&&J&&d.value&&(we=!0,be()),!J){const V=k.xSnapped-(W.x??0),H=k.ySnapped-(W.y??0);Math.sqrt(V*V+H*H)>s.value&&xe(Y,C)}(W.x!==k.xSnapped||W.y!==k.ySnapped)&&R.length&&J&&(T=Y.sourceEvent,oe=kt(Y.sourceEvent,P),me(k))},ye=Y=>{let C=!1;if(!J&&!v.value&&!h.value){const k=Y.sourceEvent,V=re(k),H=V.xSnapped-(W.x??0),te=V.ySnapped-(W.y??0),ne=Math.sqrt(H*H+te*te);ne!==0&&ne<=s.value&&(G==null||G(k),C=!0)}if(R.length&&!C){se&&(y(R,!1,!1),se=!1);const[k,V]=nl({id:de,dragItems:R,findNode:m});q({event:Y.sourceEvent,node:k,nodes:V})}R=[],v.value=!1,we=!1,J=!1,W={x:void 0,y:void 0},cancelAnimationFrame(he)};return n.watch([()=>n.toValue(Q),X],([Y,C],k,V)=>{if(C){const H=ut(C);Y||(E=Bh().on("start",te=>Ce(te,C)).on("drag",te=>Se(te,C)).on("end",te=>ye(te)).filter(te=>{const ne=te.target,ge=n.toValue(ee);return!te.button&&(!a.value||!Mc(ne,`.${a.value}`,C)&&(!ge||Mc(ne,ge,C)))}),H.call(E)),V(()=>{H.on(".drag",null),E&&(E.on("start",null),E.on("drag",null),E.on("end",null))})}}),v}function cb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function db(e,t){const o=cb();return o.doubleClick.on(i=>{var a,l;t.edgeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.edgeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.edgeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.edgeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.edgeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.edgeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.updateStart.on(i=>{var a,l;t.edgeUpdateStart(i),(l=(a=e.events)==null?void 0:a.updateStart)==null||l.call(a,i)}),o.update.on(i=>{var a,l;t.edgeUpdate(i),(l=(a=e.events)==null?void 0:a.update)==null||l.call(a,i)}),o.updateEnd.on(i=>{var a,l;t.edgeUpdateEnd(i),(l=(a=e.events)==null?void 0:a.updateEnd)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function ub(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=De();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=jg(a)?a.sourceEvent:a,{x:c,y:d}=kt(s,r),u=yo({x:c,y:d},e.value),{x:f,y:p}=o.value?ki(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function Ni(){return!0}function jc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:b,findNode:g,panBy:_,startConnection:N,updateConnection:y,endConnection:$,emits:K,viewport:F,edges:q,nodes:G,isValidConnection:X,nodeLookup:Q}=De();let de=null,B=!1,ee=null;function v(E){var P;const W=n.toValue(o)==="target",oe=il(E),T=bc(E.target),J=E.currentTarget;if(J&&(oe&&E.button===0||!oe)){let se=function(w){k=kt(w,ye),me=tb(yo(k,F.value,!1,[1,1]),u.value,Q.value,te),V||(H(),V=!0);const x=Lc(w,{handle:me,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:W?"target":"source",isValidConnection:re,doc:T,lib:"vue",flowId:s,nodeLookup:Q.value},q.value,G.value,g,Q.value);ee=x.handleDomNode,de=x.connection,B=ob(!!me,x.isValid);const j={...Ee,isValid:B,to:x.toHandle&&B?ho({x:x.toHandle.x,y:x.toHandle.y},F.value):k,toHandle:x.toHandle,toPosition:B&&x.toHandle?x.toHandle.position:ll[te.position],toNode:x.toHandle?Q.value.get(x.toHandle.nodeId):null};if(B&&me&&(Ee!=null&&Ee.toHandle)&&j.toHandle&&Ee.toHandle.type===j.toHandle.type&&Ee.toHandle.nodeId===j.toHandle.nodeId&&Ee.toHandle.id===j.toHandle.id&&Ee.to.x===j.to.x&&Ee.to.y===j.to.y)return;const le=me??x.toHandle;if(y(le&&B?ho({x:le.x,y:le.y},F.value):k,le,nb(!!le,B)),Ee=j,!me&&!B&&!ee)return al(C);de&&de.source!==de.target&&ee&&(al(C),C=ee,ee.classList.add("connecting","vue-flow__handle-connecting"),ee.classList.toggle("valid",!!B),ee.classList.toggle("vue-flow__handle-valid",!!B))},he=function(w){"touches"in w&&w.touches.length>0||((me||ee)&&de&&B&&(l?l(w,de):K.connect(de)),K.connectEnd(w),a&&(r==null||r(w)),al(C),cancelAnimationFrame(be),$(w),V=!1,B=!1,de=null,ee=null,T.removeEventListener("mousemove",se),T.removeEventListener("mouseup",he),T.removeEventListener("touchmove",se),T.removeEventListener("touchend",he))};const we=g(n.toValue(t));let re=n.toValue(i)||X.value||Ni;!re&&we&&(re=(W?we.isValidSourcePos:we.isValidTargetPos)||Ni);let me,be=0;const{x:xe,y:Ce}=kt(E),Se=Pc(n.toValue(a),J),ye=(P=c.value)==null?void 0:P.getBoundingClientRect();if(!ye||!Se)return;const Y=zc(n.toValue(t),Se,n.toValue(e),Q.value,d.value);if(!Y)return;let C,k=kt(E,ye),V=!1;const H=()=>{if(!h.value)return;const[w,x]=Sc(k,ye,b.value);_({x:w,y:x}),be=requestAnimationFrame(H)},te={...Y,nodeId:n.toValue(t),type:Se,position:Y.position},ne=Q.value.get(n.toValue(t)),ve={inProgress:!0,isValid:null,from:Mn(ne,te,Ie.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:ne,to:k,toHandle:null,toPosition:ll[te.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Se,position:(J==null?void 0:J.getAttribute("data-handlepos"))||Ie.Top,...k},{x:xe-ye.left,y:Ce-ye.top}),K.connectStart({event:E,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Se});let Ee=ve;T.addEventListener("mousemove",se),T.addEventListener("mouseup",he),T.addEventListener("touchmove",se),T.addEventListener("touchend",he)}}function R(E){var P,W;if(!f.value)return;const oe=n.toValue(o)==="target";if(!p.value){K.clickConnectStart({event:E,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Ie.Top,...kt(E)},void 0,!0);return}let T=n.toValue(i)||X.value||Ni;const J=g(n.toValue(t));if(!T&&J&&(T=(oe?J.isValidSourcePos:J.isValidTargetPos)||Ni),J&&(typeof J.connectable>"u"?m.value:J.connectable)===!1)return;const se=bc(E.target),he=Lc(E,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Ie.Top,...kt(E)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:T,doc:se,lib:"vue",flowId:s,nodeLookup:Q.value},q.value,G.value,g,Q.value),we=((P=he.connection)==null?void 0:P.source)===((W=he.connection)==null?void 0:W.target);he.isValid&&he.connection&&!we&&K.connect(he.connection),K.clickConnectEnd(E),$(E,!0)}return{handlePointerDown:v,handleClick:R}}function fb(){return n.inject(Kc,"")}function Zc(e){const t=e??fb()??"",o=n.inject(qc,n.ref(null)),{findNode:i,edges:a,emits:l}=De(),r=i(t);return r||l.error(new qe(Ge.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>dn([r],a.value))}}function mb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function pb(e,t){const o=mb();return o.doubleClick.on(i=>{var a,l;t.nodeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.nodeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.nodeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.nodeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.nodeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.nodeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.dragStart.on(i=>{var a,l;t.nodeDragStart(i),(l=(a=e.events)==null?void 0:a.dragStart)==null||l.call(a,i)}),o.drag.on(i=>{var a,l;t.nodeDrag(i),(l=(a=e.events)==null?void 0:a.drag)==null||l.call(a,i)}),o.dragStop.on(i=>{var a,l;t.nodeDragStop(i),(l=(a=e.events)==null?void 0:a.dragStop)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function Jc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=De();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,p=d?4:1,m=c.x*u*p,h=c.y*f*p,b=[];for(const g of e.value)if(g.draggable||r&&typeof g.draggable>"u"){const _={x:g.computedPosition.x+m,y:g.computedPosition.y+h},{position:N}=ol(g,_,s.error,t.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:N,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const $i=.1,hb=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Yt(){return _o("Viewport not initialized yet."),Promise.resolve(!1)}const yb={zoomIn:Yt,zoomOut:Yt,zoomTo:Yt,fitView:Yt,setCenter:Yt,fitBounds:Yt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Yt,setTransform:Yt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function gb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ao:ri).scaleBy(dl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)})}function o(i,a,l,r){return new Promise(s=>{var c;const{x:d,y:u}=gc({x:-i,y:-a},e.translateExtent),f=Vn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?ao:ri).transform(dl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,l)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?ao:ri).scaleTo(dl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{r(!0)}),a):r(!1)}),setViewport:(a,l)=>o(a.x,a.y,a.zoom,l),setTransform:(a,l)=>o(a.x,a.y,a.zoom,l),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:$i,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Qa(s),{x:d,y:u,zoom:f}=$c(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??$i);return o(d,u,f,a)},setCenter:(a,l,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-l*s;return o(c,d,s,r)},fitBounds:(a,l={padding:$i})=>{const{x:r,y:s,zoom:c}=$c(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??$i);return o(r,s,c,l)},project:a=>yo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-l,y:a.y-r};return yo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+l,y:a.y+r};return ho(s,e.viewport)}return{x:0,y:0}}}:yb)}function dl(e,t=0,o=hb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function bb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,_=!!(o.nodes.value.length||o.edges.value.length);b=xn([e.modelValue,()=>{var N,y;return(y=(N=e.modelValue)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setElements(N),!g&&!_&&N.length?_=!0:g==null||g.resume())}),g=xn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,y])=>{var $;($=e.modelValue)!=null&&$.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...N,...y],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,_=!!o.nodes.value.length;b=xn([e.nodes,()=>{var N,y;return(y=(N=e.nodes)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setNodes(N),!g&&!_&&N.length?_=!0:g==null||g.resume())}),g=xn([o.nodes,()=>o.nodes.value.length],([N])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...N],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,_=!!o.edges.value.length;b=xn([e.edges,()=>{var N,y;return(y=(N=e.edges)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setEdges(N),!g&&!_&&N.length?_=!0:g==null||g.resume())}),g=xn([o.edges,()=>o.edges.value.length],([N])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...N],n.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Ye(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Ye(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Ye(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Ye(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Ye(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const b=async g=>{let _=g;typeof t.autoConnect=="function"&&(_=await t.autoConnect(g)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Ye(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(g,_,N)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),N(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},m=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(t)){const _=g;if(!b.includes(_)){const N=n.toRef(()=>t[_]),y=o[_];n.isRef(y)&&i.run(()=>{n.watch(N,$=>{Ye($)&&(y.value=$)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function _b(){return{edgesChange:$e(),nodesChange:$e(),nodeDoubleClick:$e(),nodeClick:$e(),nodeMouseEnter:$e(),nodeMouseMove:$e(),nodeMouseLeave:$e(),nodeContextMenu:$e(),nodeDragStart:$e(),nodeDrag:$e(),nodeDragStop:$e(),nodesInitialized:$e(),miniMapNodeClick:$e(),miniMapNodeDoubleClick:$e(),miniMapNodeMouseEnter:$e(),miniMapNodeMouseMove:$e(),miniMapNodeMouseLeave:$e(),connect:$e(),connectStart:$e(),connectEnd:$e(),clickConnectStart:$e(),clickConnectEnd:$e(),paneReady:$e(),init:$e(),move:$e(),moveStart:$e(),moveEnd:$e(),selectionDragStart:$e(),selectionDrag:$e(),selectionDragStop:$e(),selectionContextMenu:$e(),selectionStart:$e(),selectionEnd:$e(),viewportChangeStart:$e(),viewportChange:$e(),viewportChangeEnd:$e(),paneScroll:$e(),paneClick:$e(),paneContextMenu:$e(),paneMouseEnter:$e(),paneMouseMove:$e(),paneMouseLeave:$e(),edgeContextMenu:$e(),edgeMouseEnter:$e(),edgeMouseMove:$e(),edgeMouseLeave:$e(),edgeDoubleClick:$e(),edgeClick:$e(),edgeUpdateStart:$e(),edgeUpdate:$e(),edgeUpdateEnd:$e(),updateNodeInternals:$e(),error:$e(e=>_o(e.message))}}function wb(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,l]of Object.entries(t.value)){const r=s=>{e(a,s)};l.setEmitter(r),Qn(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),Qn(l.removeHasEmitListeners)}});function i(a){var l;const r=vb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function vb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Qc(){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:ja.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:fo.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:rn.Bezier,style:{}},connectionMode:At.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:bo()?"Meta":"Control",zoomActivationKeyCode:bo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:_b(),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 kb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Eb(e,t,o){const i=gb(e),a=k=>{const V=k??[];e.hooks.updateNodeInternals.trigger(V)},l=k=>Lg(k,e.nodes,e.edges),r=k=>Og(k,e.nodes,e.edges),s=k=>dn(k,e.edges),c=({id:k,type:V,nodeId:H})=>{var te;const ne=k?`-${V}-${k}`:`-${V}`;return Array.from(((te=e.connectionLookup.get(`${H}${ne}`))==null?void 0:te.values())??[])},d=k=>{if(k)return t.value.get(k)},u=k=>{if(k)return o.value.get(k)},f=(k,V,H)=>{var te,ne;const ge=[];for(const ve of k){const Ee={id:ve.id,type:"position",dragging:H,from:ve.from};if(V&&(Ee.position=ve.position,ve.parentNode)){const w=d(ve.parentNode);Ee.position={x:Ee.position.x-(((te=w==null?void 0:w.computedPosition)==null?void 0:te.x)??0),y:Ee.position.y-(((ne=w==null?void 0:w.computedPosition)==null?void 0:ne.y)??0)}}ge.push(Ee)}ge!=null&&ge.length&&e.hooks.nodesChange.trigger(ge)},p=k=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const H=window.getComputedStyle(V),{m22:te}=new window.DOMMatrixReadOnly(H.transform),ne=[];for(const ge of k){const ve=ge,Ee=d(ve.id);if(Ee){const w=_i(ve.nodeElement);if(!!(w.width&&w.height&&(Ee.dimensions.width!==w.width||Ee.dimensions.height!==w.height||ve.forceUpdate))){const j=ve.nodeElement.getBoundingClientRect();Ee.dimensions=w,Ee.handleBounds.source=Hc("source",ve.nodeElement,j,te,Ee.id),Ee.handleBounds.target=Hc("target",ve.nodeElement,j,te,Ee.id),ne.push({id:Ee.id,type:"dimensions",dimensions:w})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ne.length&&e.hooks.nodesChange.trigger(ne)},m=(k,V)=>{const H=new Set,te=new Set;for(const ve of k)cn(ve)?H.add(ve.id):Ht(ve)&&te.add(ve.id);const ne=Gt(t.value,H,!0),ge=Gt(o.value,te);if(e.multiSelectionActive){for(const ve of H)ne.push(Ft(ve,V));for(const ve of te)ge.push(Ft(ve,V))}ne.length&&e.hooks.nodesChange.trigger(ne),ge.length&&e.hooks.edgesChange.trigger(ge)},h=k=>{if(e.multiSelectionActive){const V=k.map(H=>Ft(H.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(Gt(t.value,new Set(k.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(Gt(o.value))},b=k=>{if(e.multiSelectionActive){const V=k.map(H=>Ft(H.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(Gt(o.value,new Set(k.map(V=>V.id)))),e.hooks.nodesChange.trigger(Gt(t.value,new Set,!0))},g=k=>{m(k,!0)},_=k=>{const H=(k||e.nodes).map(te=>(te.selected=!1,Ft(te.id,!1)));e.hooks.nodesChange.trigger(H)},N=k=>{const H=(k||e.edges).map(te=>(te.selected=!1,Ft(te.id,!1)));e.hooks.edgesChange.trigger(H)},y=k=>{if(!k||!k.length)return m([],!1);const V=k.reduce((H,te)=>{const ne=Ft(te.id,!1);return cn(te)?H.nodes.push(ne):H.edges.push(ne),H},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},$=k=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([k,e.maxZoom]),e.minZoom=k},K=k=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,k]),e.maxZoom=k},F=k=>{var V;(V=e.d3Zoom)==null||V.translateExtent(k),e.translateExtent=k},q=k=>{e.nodeExtent=k,a()},G=k=>{var V;(V=e.d3Zoom)==null||V.clickDistance(k)},X=k=>{e.nodesDraggable=k,e.nodesConnectable=k,e.elementsSelectable=k},Q=k=>{const V=k instanceof Function?k(e.nodes):k;!e.initialized&&!V.length||(e.nodes=Fc(V,d,e.hooks.error.trigger))},de=k=>{const V=k instanceof Function?k(e.edges):k;if(!e.initialized&&!V.length)return;const H=cl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);sl(e.connectionLookup,o.value,H),e.edges=H},B=k=>{const V=k instanceof Function?k([...e.nodes,...e.edges]):k;!e.initialized&&!V.length||(Q(V.filter(cn)),de(V.filter(Ht)))},ee=k=>{let V=k instanceof Function?k(e.nodes):k;V=Array.isArray(V)?V:[V];const H=Fc(V,d,e.hooks.error.trigger),te=[];for(const ne of H)te.push(Rc(ne));te.length&&e.hooks.nodesChange.trigger(te)},v=k=>{let V=k instanceof Function?k(e.edges):k;V=Array.isArray(V)?V:[V];const H=cl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),te=[];for(const ne of H)te.push(Rc(ne));te.length&&e.hooks.edgesChange.trigger(te)},R=(k,V=!0,H=!1)=>{const te=k instanceof Function?k(e.nodes):k,ne=Array.isArray(te)?te:[te],ge=[],ve=[];function Ee(x){const j=s(x);for(const le of j)(!Ye(le.deletable)||le.deletable)&&ve.push(Ac(le.id,le.source,le.target,le.sourceHandle,le.targetHandle))}function w(x){const j=[];for(const le of e.nodes)le.parentNode===x&&j.push(le);if(j.length){for(const le of j)ge.push(Vc(le.id));V&&Ee(j);for(const le of j)w(le.id)}}for(const x of ne){const j=typeof x=="string"?d(x):x;j&&(Ye(j.deletable)&&!j.deletable||(ge.push(Vc(j.id)),V&&Ee([j]),H&&w(j.id)))}ve.length&&e.hooks.edgesChange.trigger(ve),ge.length&&e.hooks.nodesChange.trigger(ge)},E=k=>{const V=k instanceof Function?k(e.edges):k,H=Array.isArray(V)?V:[V],te=[];for(const ne of H){const ge=typeof ne=="string"?u(ne):ne;ge&&(Ye(ge.deletable)&&!ge.deletable||te.push(Ac(typeof ne=="string"?ne:ne.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle)))}e.hooks.edgesChange.trigger(te)},P=(k,V,H=!0)=>{const te=u(k.id);if(!te)return!1;const ne=e.edges.indexOf(te),ge=lb(k,V,te,H,e.hooks.error.trigger);if(ge){const[ve]=cl([ge],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ee,w)=>w===ne?ve:Ee),sl(e.connectionLookup,o.value,[ve]),ve}return!1},W=(k,V,H={replace:!1})=>{const te=u(k);if(!te)return;const ne=typeof V=="function"?V(te):V;te.data=H.replace?ne:{...te.data,...ne}},oe=k=>Cc(k,e.nodes),T=k=>{const V=Cc(k,e.edges);return sl(e.connectionLookup,o.value,V),V},J=(k,V,H={replace:!1})=>{const te=d(k);if(!te)return;const ne=typeof V=="function"?V(te):V;H.replace?e.nodes.splice(e.nodes.indexOf(te),1,ne):Object.assign(te,ne)},se=(k,V,H={replace:!1})=>{const te=d(k);if(!te)return;const ne=typeof V=="function"?V(te):V;te.data=H.replace?ne:{...te.data,...ne}},he=(k,V,H=!1)=>{H?e.connectionClickStartHandle=k:e.connectionStartHandle=k,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},we=(k,V=null,H=null)=>{e.connectionStartHandle&&(e.connectionPosition=k,e.connectionEndHandle=V,e.connectionStatus=H)},re=(k,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},me=k=>{const V=Bg(k),H=V?null:po(k)?k:d(k.id);return!V&&!H?[null,null,V]:[V?k:gi(H),H,V]},be=(k,V=!0,H=e.nodes)=>{const[te,ne,ge]=me(k);if(!te)return[];const ve=[];for(const Ee of H||e.nodes){if(!ge&&(Ee.id===ne.id||!Ee.computedPosition))continue;const w=gi(Ee),x=bi(w,te);(V&&x>0||x>=w.width*w.height||x>=Number(te.width)*Number(te.height))&&ve.push(Ee)}return ve},xe=(k,V,H=!0)=>{const[te]=me(k);if(!te)return!1;const ne=bi(te,V);return H&&ne>0||ne>=Number(te.width)*Number(te.height)},Ce=k=>{const{viewport:V,dimensions:H,d3Zoom:te,d3Selection:ne,translateExtent:ge}=e;if(!te||!ne||!k.x&&!k.y)return!1;const ve=Vn.translate(V.x+k.x,V.y+k.y).scale(V.zoom),Ee=[[0,0],[H.width,H.height]],w=te.constrain()(ve,Ee,ge),x=e.viewport.x!==w.x||e.viewport.y!==w.y||e.viewport.zoom!==w.k;return te.transform(ne,w),x},Se=k=>{const V=k instanceof Function?k(e):k,H=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ye(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const te=V.modelValue||V.nodes||V.edges?[]:void 0;te&&(V.modelValue&&te.push(...V.modelValue),V.nodes&&te.push(...V.nodes),V.edges&&te.push(...V.edges),B(te));const ne=()=>{Ye(V.maxZoom)&&K(V.maxZoom),Ye(V.minZoom)&&$(V.minZoom),Ye(V.translateExtent)&&F(V.translateExtent)};for(const ge of Object.keys(V)){const ve=ge,Ee=V[ve];![...kb,...H].includes(ve)&&Ye(Ee)&&(e[ve]=Ee)}Ca(()=>e.d3Zoom).not.toBeNull().then(ne),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:B,setNodes:Q,setEdges:de,addNodes:ee,addEdges:v,removeNodes:R,removeEdges:E,findNode:d,findEdge:u,updateEdge:P,updateEdgeData:W,updateNode:J,updateNodeData:se,applyEdgeChanges:T,applyNodeChanges:oe,addSelectedElements:g,addSelectedNodes:h,addSelectedEdges:b,setMinZoom:$,setMaxZoom:K,setTranslateExtent:F,setNodeExtent:q,setPaneClickDistance:G,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:N,startConnection:he,updateConnection:we,endConnection:re,setInteractive:X,setState:Se,getIntersectingNodes:be,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:xe,panBy:Ce,fitView:k=>i.value.fitView(k),zoomIn:k=>i.value.zoomIn(k),zoomOut:k=>i.value.zoomOut(k),zoomTo:(k,V)=>i.value.zoomTo(k,V),setViewport:(k,V)=>i.value.setViewport(k,V),setTransform:(k,V)=>i.value.setTransform(k,V),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(k,V,H)=>i.value.setCenter(k,V,H),fitBounds:(k,V)=>i.value.fitBounds(k,V),project:k=>i.value.project(k),screenToFlowCoordinate:k=>i.value.screenToFlowCoordinate(k),flowToScreenCoordinate:k=>i.value.flowToScreenCoordinate(k),toObject:()=>{const k=[],V=[];for(const H of e.nodes){const{computedPosition:te,handleBounds:ne,selected:ge,dimensions:ve,isParent:Ee,resizing:w,dragging:x,events:j,...le}=H;k.push(le)}for(const H of e.edges){const{selected:te,sourceNode:ne,targetNode:ge,events:ve,...Ee}=H;V.push(Ee)}return JSON.parse(JSON.stringify({nodes:k,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:k=>new Promise(V=>{const{nodes:H,edges:te,position:ne,zoom:ge,viewport:ve}=k;H&&Q(H),te&&de(te);const[Ee,w]=ve!=null&&ve.x&&(ve!=null&&ve.y)?[ve.x,ve.y]:ne??[null,null];if(Ee&&w){const x=(ve==null?void 0:ve.zoom)||ge||e.viewport.zoom;return Ca(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ee,y:w,zoom:x}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const k=Qc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=Vn.translate(k.defaultViewport.x??0,k.defaultViewport.y??0).scale(sn(k.defaultViewport.zoom??1,k.minZoom,k.maxZoom)),H=e.viewportRef.getBoundingClientRect(),te=[[0,0],[H.width,H.height]],ne=e.d3Zoom.constrain()(V,te,k.translateExtent);e.d3Zoom.transform(e.d3Selection,ne)}Se(k)},$destroy:()=>{}}}const Nb=["data-id","data-handleid","data-nodeid","data-handlepos"],$b={name:"Handle",compatConfig:{MODE:3}},un=n.defineComponent({...$b,props:{id:{default:null},type:{},position:{default:()=>Ie.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:l,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:p}=De(),{id:m,node:h,nodeEl:b,connectedEdges:g}=Zc(),_=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),$=n.toRef(()=>{var de,B,ee,v,R,E;return((de=r.value)==null?void 0:de.nodeId)===m&&((B=r.value)==null?void 0:B.id)===e.id&&((ee=r.value)==null?void 0:ee.type)===i.value||((v=c.value)==null?void 0:v.nodeId)===m&&((R=c.value)==null?void 0:R.id)===e.id&&((E=c.value)==null?void 0:E.type)===i.value}),K=n.toRef(()=>{var de,B,ee;return((de=s.value)==null?void 0:de.nodeId)===m&&((B=s.value)==null?void 0:B.id)===e.id&&((ee=s.value)==null?void 0:ee.type)===i.value}),{handlePointerDown:F,handleClick:q}=jc({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),G=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(de=>{const B=de[`${i.value}Handle`];return de[i.value]!==m?!1:B?B===e.id:!0}):typeof e.connectable=="number"?g.value.filter(de=>{const B=de[`${i.value}Handle`];return de[i.value]!==m?!1:B?B===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,g.value):Ye(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var de;if(!h.dimensions.width||!h.dimensions.height)return;const B=(de=h.handleBounds[i.value])==null?void 0:de.find(oe=>oe.id===e.id);if(!d.value||B)return;const ee=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!ee||!e.id)return;const v=b.value.getBoundingClientRect(),R=_.value.getBoundingClientRect(),E=window.getComputedStyle(ee),{m22:P}=new window.DOMMatrixReadOnly(E.transform),W={id:e.id,position:e.position,x:(R.left-v.left)/P,y:(R.top-v.top)/P,type:i.value,nodeId:m,..._i(_.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],W]});function X(de){const B=il(de);G.value&&N.value&&(B&&de.button===0||!B)&&F(de)}function Q(de){!m||!s.value&&!N.value||G.value&&q(de)}return t({handleClick:q,handlePointerDown:F,onClick:Q,onPointerDown:X}),(de,B)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":de.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${de.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:G.value,connecting:K.value,connectablestart:N.value,connectableend:y.value,connectionindicator:G.value&&(N.value&&!$.value||y.value&&$.value)}]]),onMousedown:X,onTouchstartPassive:X,onClick:Q},[n.renderSlot(de.$slots,"default",{id:de.id})],42,Nb))}}),xi=function({sourcePosition:e=Ie.Bottom,targetPosition:t=Ie.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(un,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(un,{type:"source",position:e,connectable:i,isValidConnection:l})]};xi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],xi.inheritAttrs=!1,xi.compatConfig={MODE:3};const xb=xi,Ii=function({targetPosition:e=Ie.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(un,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Ii.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ii.inheritAttrs=!1,Ii.compatConfig={MODE:3};const Ib=Ii,Si=function({sourcePosition:e=Ie.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const l=a.label??t;return[typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l]),n.h(un,{type:"source",position:e,connectable:o,isValidConnection:i})]};Si.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Si.inheritAttrs=!1,Si.compatConfig={MODE:3};const Sb=Si,Cb=["transform"],Rb=["width","height","x","y","rx","ry"],Vb=["y"],Ab={name:"EdgeText",compatConfig:{MODE:3}},Tb=n.defineComponent({...Ab,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const l=o.value.getBBox();(l.width!==t.value.width||l.height!==t.value.height)&&(t.value=l)}return(l,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[l.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*l.labelBgPadding[0]}px`,height:`${t.value.height+2*l.labelBgPadding[1]}px`,x:-l.labelBgPadding[0],y:-l.labelBgPadding[1],style:n.normalizeStyle(l.labelBgStyle),rx:l.labelBgBorderRadius,ry:l.labelBgBorderRadius},null,12,Rb)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(l.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:l.labelStyle}),[n.renderSlot(l.$slots,"default",{},()=>[typeof l.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.label),1)],64))])],16,Vb)],8,Cb))}}),Mb=["id","d","marker-end","marker-start"],Bb=["d","stroke-width"],Db={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ci=n.defineComponent({...Db,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),l=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(l),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,Mb),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Bb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(Tb,{key:1,ref_key:"labelEl",ref:a,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function ed({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,l=o<e?o+a:o-a,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[l,s,a,r]}function td({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:r,targetControlY:s}){const c=e*.125+a*.375+r*.375+o*.125,d=t*.125+l*.375+s*.375+i*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function Ri(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function nd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Ie.Left:r=t-Ri(t-i,l),s=o;break;case Ie.Right:r=t+Ri(i-t,l),s=o;break;case Ie.Top:r=t,s=o-Ri(o-a,l);break;case Ie.Bottom:r=t,s=o+Ri(a-o,l);break}return[r,s]}function od(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,curvature:s=.25}=e,[c,d]=nd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=nd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[p,m,h,b]=td({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,p,m,h,b]}function id({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Ie.Left:case Ie.Right:l=.5*(t+i),r=o;break;case Ie.Top:case Ie.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function ad(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top}=e,[s,c]=id({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=id({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,p,m,h]=td({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,p,m,h]}const ld={[Ie.Left]:{x:-1,y:0},[Ie.Right]:{x:1,y:0},[Ie.Top]:{x:0,y:-1},[Ie.Bottom]:{x:0,y:1}};function Ob({source:e,sourcePosition:t=Ie.Bottom,target:o}){return t===Ie.Left||t===Ie.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 rd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Lb({source:e,sourcePosition:t=Ie.Bottom,target:o,targetPosition:i=Ie.Top,center:a,offset:l}){const r=ld[t],s=ld[i],c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:o.x+s.x*l,y:o.y+s.y*l},u=Ob({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,h,b;const g={x:0,y:0},_={x:0,y:0},[N,y,$,K]=ed({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){h=a.x??N,b=a.y??y;const q=[{x:h,y:c.y},{x:h,y:d.y}],G=[{x:c.x,y:b},{x:d.x,y:b}];r[f]===p?m=f==="x"?q:G:m=f==="x"?G:q}else{const q=[{x:c.x,y:d.y}],G=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?G:q:m=r.y===p?q:G,t===i){const ee=Math.abs(e[f]-o[f]);if(ee<=l){const v=Math.min(l-1,l-ee);r[f]===p?g[f]=(c[f]>e[f]?-1:1)*v:_[f]=(d[f]>o[f]?-1:1)*v}}if(t!==i){const ee=f==="x"?"y":"x",v=r[f]===s[ee],R=c[ee]>d[ee],E=c[ee]<d[ee];(r[f]===1&&(!v&&R||v&&E)||r[f]!==1&&(!v&&E||v&&R))&&(m=f==="x"?q:G)}const X={x:c.x+g.x,y:c.y+g.y},Q={x:d.x+_.x,y:d.y+_.y},de=Math.max(Math.abs(X.x-m[0].x),Math.abs(Q.x-m[0].x)),B=Math.max(Math.abs(X.y-m[0].y),Math.abs(Q.y-m[0].y));de>=B?(h=(X.x+Q.x)/2,b=m[0].y):(h=m[0].x,b=(X.y+Q.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...m,{x:d.x+_.x,y:d.y+_.y},o],h,b,$,K]}function Pb(e,t,o,i){const a=Math.min(rd(e,t)/2,rd(t,o)/2,i),{x:l,y:r}=t;if(e.x===l&&l===o.x||e.y===r&&r===o.y)return`L${l} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${l+a*d},${r}Q ${l},${r} ${l},${r+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${l},${r+a*c}Q ${l},${r} ${l+a*s},${r}`}function ul(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,h,b]=Lb({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,N,y)=>{let $;return y>0&&y<f.length-1?$=Pb(f[y-1],N,f[y+1],s):$=`${y===0?"M":"L"}${N.x} ${N.y}`,_+=$,_},""),p,m,h,b]}function zb(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=ed({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const Ub=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=zb(e);return n.h(Ci,{path:o,labelX:i,labelY:a,...t,...e})}}}),sd=n.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=ul({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ci,{path:o,labelX:i,labelY:a,...t,...e})}}}),Hb=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(sd,{...e,...t,borderRadius:0})}}),Fb=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=od({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ci,{path:o,labelX:i,labelY:a,...t,...e})}}}),Gb=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=ad({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ci,{path:o,labelX:i,labelY:a,...t,...e})}}}),Yb={input:Sb,default:xb,output:Ib},Wb={default:Fb,straight:Ub,step:Hb,smoothstep:sd,simplebezier:Gb};function Kb(e,t,o){const i=n.computed(()=>b=>t.value.get(b)),a=n.computed(()=>b=>o.value.get(b)),l=n.computed(()=>{const b={...Wb,...e.edgeTypes},g=Object.keys(b);for(const _ of e.edges)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),r=n.computed(()=>{const b={...Yb,...e.nodeTypes},g=Object.keys(b);for(const _ of e.nodes)_.type&&!g.includes(_.type)&&(b[_.type]=_.type);return b}),s=n.computed(()=>e.onlyRenderVisibleElements?Nc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const g of e.edges){const _=t.value.get(g.source),N=t.value.get(g.target);qg({sourcePos:_.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),f=n.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),h=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:h}}class fn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??fn.instance;return fn.instance=i??new fn,o&&(o.config.globalProperties.$vueFlowStorage=fn.instance),fn.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=Qc(),a=n.reactive(i),l={};for(const[p,m]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;l[h]=m.on}const r={};for(const[p,m]of Object.entries(a.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of a.nodes)p.set(m.id,m);return p}),c=n.computed(()=>{const p=new Map;for(const m of a.edges)p.set(m.id,m);return p}),d=Kb(a,s,c),u=Eb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Gm(a),nodeLookup:s,edgeLookup:c,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function De(e){const t=fn.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},l=a.id,r=l??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(Wc,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,p,m)=>{const h=g=>{d.applyNodeChanges(g)},b=g=>{d.applyEdgeChanges(g)};f?(d.onNodesChange(h),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(b)),m(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),Qn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():_o(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(Wc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new qe(Ge.USEVUEFLOW_OPTIONS))}return s}function qb(e){const{emits:t,dimensions:o}=De();let i;n.onMounted(()=>{const a=()=>{var l,r;if(!e.value||!(((r=(l=e.value).checkVisibility)==null?void 0:r.call(l))??!0))return;const s=_i(e.value);(s.width===0||s.height===0)&&t.error(new qe(Ge.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const Xb={name:"UserSelection",compatConfig:{MODE:3}},jb=n.defineComponent({...Xb,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Zb=["tabIndex"],Jb={name:"NodesSelection",compatConfig:{MODE:3}},Qb=n.defineComponent({...Jb,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=De(),s=Jc(),c=n.ref(null),d=Xc({el:c,onStart(h){t.selectionDragStart(h),t.nodeDragStart(h)},onDrag(h){t.selectionDrag(h),t.nodeDrag(h)},onStop(h){t.selectionDragStop(h),t.nodeDragStop(h)}});n.onMounted(()=>{var h;l.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=n.computed(()=>Qa(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){t.selectionContextMenu({event:h,nodes:i.value})}function m(h){l.value||An[h.key]&&(h.preventDefault(),s({x:An[h.key].x,y:An[h.key].y},h.shiftKey))}return(h,b)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,Zb)],6)):n.createCommentVNode("",!0)}});function e0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const t0={name:"Pane",compatConfig:{MODE:3}},n0=n.defineComponent({...t0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:h,deleteKeyCode:b,multiSelectionKeyCode:g,multiSelectionActive:_,edgeLookup:N,nodeLookup:y,connectionLookup:$,defaultEdgeOptions:K,connectionStartHandle:F,panOnDrag:q}=De(),G=n.shallowRef(null),X=n.shallowRef(new Set),Q=n.shallowRef(new Set),de=n.shallowRef(null),B=n.toRef(()=>c.value&&(e.isSelecting||l.value)),ee=n.toRef(()=>F.value!==null);let v=!1,R=!1;const E=mo(b,{actInsideInputWithModifier:!1}),P=mo(g);n.watch(E,re=>{re&&(p(f.value),m(u.value),d.value=!1)}),n.watch(P,re=>{_.value=re});function W(re,me){return be=>{be.target===me&&(re==null||re(be))}}function oe(re){if(v||ee.value){v=!1;return}a.paneClick(re),r(),d.value=!1}function T(re){var me;if(Array.isArray(q.value)&&((me=q.value)!=null&&me.includes(2))){re.preventDefault();return}a.paneContextMenu(re)}function J(re){a.paneScroll(re)}function se(re){var me,be,xe;if(de.value=((me=t.value)==null?void 0:me.getBoundingClientRect())??null,!c.value||!e.isSelecting||re.button!==0||re.target!==G.value||!de.value)return;(xe=(be=re.target)==null?void 0:be.setPointerCapture)==null||xe.call(be,re.pointerId);const{x:Ce,y:Se}=e0(re,de.value);R=!0,v=!1,r(),s.value={width:0,height:0,startX:Ce,startY:Se,x:Ce,y:Se},a.selectionStart(re)}function he(re){var me;if(!de.value||!s.value)return;v=!0;const{x:be,y:xe}=kt(re,de.value),{startX:Ce=0,startY:Se=0}=s.value,ye={startX:Ce,startY:Se,x:be<Ce?be:Ce,y:xe<Se?xe:Se,width:Math.abs(be-Ce),height:Math.abs(xe-Se)},Y=X.value,C=Q.value;X.value=new Set(Nc(o.value,ye,i.value,h.value===ja.Partial,!0).map(V=>V.id)),Q.value=new Set;const k=((me=K.value)==null?void 0:me.selectable)??!0;for(const V of X.value){const H=$.value.get(V);if(H)for(const{edgeId:te}of H.values()){const ne=N.value.get(te);ne&&(ne.selectable??k)&&Q.value.add(te)}}if(!Yc(Y,X.value)){const V=Gt(y.value,X.value,!0);a.nodesChange(V)}if(!Yc(C,Q.value)){const V=Gt(N.value,Q.value);a.edgesChange(V)}s.value=ye,l.value=!0,d.value=!1}function we(re){var me;re.button!==0||!R||((me=re.target)==null||me.releasePointerCapture(re.pointerId),!l.value&&s.value&&re.target===G.value&&oe(re),l.value=!1,s.value=null,d.value=X.value.size>0,a.selectionEnd(re),e.selectionKeyPressed&&(v=!1),R=!1)}return(re,me)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:G,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:re.isSelecting}]),onClick:me[0]||(me[0]=be=>B.value?void 0:W(oe,G.value)(be)),onContextmenu:me[1]||(me[1]=be=>W(T,G.value)(be)),onWheelPassive:me[2]||(me[2]=be=>W(J,G.value)(be)),onPointerenter:me[3]||(me[3]=be=>B.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:me[4]||(me[4]=be=>B.value?se(be):n.unref(a).paneMouseMove(be)),onPointermove:me[5]||(me[5]=be=>B.value?he(be):n.unref(a).paneMouseMove(be)),onPointerup:me[6]||(me[6]=be=>B.value?we(be):void 0),onPointerleave:me[7]||(me[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(re.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(jb,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(f).length?(n.openBlock(),n.createBlock(Qb,{key:1})):n.createCommentVNode("",!0)],34))}}),o0={name:"Transform",compatConfig:{MODE:3}},i0=n.defineComponent({...o0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=De(),a=n.computed(()=>o.value?!i.value:!1),l=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:l.value,opacity:a.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),a0={name:"Viewport",compatConfig:{MODE:3}},l0=n.defineComponent({...a0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:h,preventScrolling:b,noWheelClassName:g,noPanClassName:_,emits:N,connectionStartHandle:y,userSelectionActive:$,paneDragging:K,d3Zoom:F,d3Selection:q,d3ZoomHandler:G,viewport:X,viewportRef:Q,paneClickDistance:de}=De();qb(Q);const B=n.shallowRef(!1),ee=n.shallowRef(!1);let v=null,R=!1,E=0,P={x:0,y:0,zoom:0};const W=mo(s),oe=mo(r),T=mo(l),J=n.toRef(()=>(!oe.value||oe.value&&r.value===!0)&&(W.value||f.value)),se=n.toRef(()=>W.value||c.value),he=n.toRef(()=>r.value===!0&&J.value!==!0),we=n.toRef(()=>oe.value&&r.value!==!0||$.value||he.value),re=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!Q.value){_o("Viewport element is missing");return}const Se=Q.value,ye=Se.getBoundingClientRect(),Y=Sg().clickDistance(de.value).scaleExtent([t.value,o.value]).translateExtent(a.value),C=ut(Se).call(Y),k=C.on("wheel.zoom"),V=Vn.translate(i.value.x??0,i.value.y??0).scale(sn(i.value.zoom??1,t.value,o.value)),H=[[0,0],[ye.width,ye.height]],te=Y.constrain()(V,H,a.value);Y.transform(C,te),Y.wheelDelta(el),F.value=Y,q.value=C,G.value=k,X.value={x:te.x,y:te.y,zoom:te.k},Y.on("start",ne=>{var ge;if(!ne.sourceEvent)return null;E=ne.sourceEvent.button,B.value=!0;const ve=xe(ne.transform);((ge=ne.sourceEvent)==null?void 0:ge.type)==="mousedown"&&(K.value=!0),P=ve,N.viewportChangeStart(ve),N.moveStart({event:ne,flowTransform:ve})}),Y.on("end",ne=>{if(!ne.sourceEvent)return null;if(B.value=!1,K.value=!1,me(J.value,E??0)&&!R&&N.paneContextMenu(ne.sourceEvent),R=!1,be(P,ne.transform)){const ge=xe(ne.transform);P=ge,N.viewportChangeEnd(ge),N.moveEnd({event:ne,flowTransform:ge})}}),Y.filter(ne=>{var ge;const ve=T.value||h.value,Ee=m.value&&ne.ctrlKey,w=ne.button,x=ne.type==="wheel";if(w===1&&ne.type==="mousedown"&&(Ce(ne,"vue-flow__node")||Ce(ne,"vue-flow__edge")))return!0;if(!J.value&&!ve&&!se.value&&!p.value&&!m.value||$.value||re.value&&!x||!p.value&&ne.type==="dblclick"||Ce(ne,g.value)&&x||Ce(ne,_.value)&&(!x||se.value&&x&&!T.value)||!m.value&&ne.ctrlKey&&x||!ve&&!se.value&&!Ee&&x)return!1;if(!m&&ne.type==="touchstart"&&((ge=ne.touches)==null?void 0:ge.length)>1)return ne.preventDefault(),!1;if(!J.value&&(ne.type==="mousedown"||ne.type==="touchstart")||he.value&&Array.isArray(f.value)&&f.value.includes(0)&&w===0||Array.isArray(f.value)&&!f.value.includes(w)&&(ne.type==="mousedown"||ne.type==="touchstart"))return!1;const j=Array.isArray(f.value)&&f.value.includes(w)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!w||w<=1;return(!ne.ctrlKey||W.value||x)&&j}),n.watch([$,J],()=>{$.value&&!B.value?Y.on("zoom",null):$.value||Y.on("zoom",ne=>{X.value={x:ne.transform.x,y:ne.transform.y,zoom:ne.transform.k};const ge=xe(ne.transform);R=me(J.value,E??0),N.viewportChange(ge),N.move({event:ne,flowTransform:ge})})},{immediate:!0}),n.watch([$,se,d,T,m,b,g],()=>{se.value&&!T.value&&!$.value?C.on("wheel.zoom",ne=>{if(Ce(ne,g.value))return!1;const ge=T.value||h.value,ve=m.value&&ne.ctrlKey;if(!(!b.value||se.value||ge||ve))return!1;ne.preventDefault(),ne.stopImmediatePropagation();const w=C.property("__zoom").k||1,x=bo();if(!W.value&&ne.ctrlKey&&m.value&&x){const U=bt(ne),M=el(ne),pe=w*2**M;Y.scaleTo(C,pe,U,ne);return}const j=ne.deltaMode===1?20:1;let le=d.value===fo.Vertical?0:ne.deltaX*j,_e=d.value===fo.Horizontal?0:ne.deltaY*j;!x&&ne.shiftKey&&d.value!==fo.Vertical&&!le&&_e&&(le=_e,_e=0),Y.translateBy(C,-(le/w)*u.value,-(_e/w)*u.value);const O=xe(C.property("__zoom"));v&&clearTimeout(v),ee.value?(N.move({event:ne,flowTransform:O}),N.viewportChange(O),v=setTimeout(()=>{N.moveEnd({event:ne,flowTransform:O}),N.viewportChangeEnd(O),ee.value=!1},150)):(ee.value=!0,N.moveStart({event:ne,flowTransform:O}),N.viewportChangeStart(O))},{passive:!1}):typeof k<"u"&&C.on("wheel.zoom",function(ne,ge){const ve=!b.value&&ne.type==="wheel"&&!ne.ctrlKey,Ee=T.value||h.value,w=m.value&&ne.ctrlKey;if(!Ee&&!c.value&&!w&&ne.type==="wheel"||ve||Ce(ne,g.value))return null;ne.preventDefault(),k.call(this,ne,ge)},{passive:!1})},{immediate:!0})});function me(Se,ye){return ye===2&&Array.isArray(Se)&&Se.includes(2)}function be(Se,ye){return Se.x!==ye.x&&!Number.isNaN(ye.x)||Se.y!==ye.y&&!Number.isNaN(ye.y)||Se.zoom!==ye.k&&!Number.isNaN(ye.k)}function xe(Se){return{x:Se.x,y:Se.y,zoom:Se.k}}function Ce(Se,ye){return Se.target.closest(`.${ye}`)}return(Se,ye)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:Q,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(n0,{"is-selecting":we.value,"selection-key-pressed":n.unref(oe),class:n.normalizeClass({connecting:re.value,dragging:n.unref(K),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(i0,null,{default:n.withCtx(()=>[n.renderSlot(Se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),r0=["id"],s0=["id"],c0=["id"],d0={name:"A11yDescriptions",compatConfig:{MODE:3}},u0=n.defineComponent({...d0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=De();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(pc)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,r0),n.createElementVNode("div",{id:`${n.unref(hc)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,s0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(Mg)}-${n.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},n.toDisplayString(n.unref(i)),9,c0))],64))}});function f0(){const e=De();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function m0(e,t,o){return o===Ie.Left?e-t:o===Ie.Right?e+t:e}function p0(e,t,o){return o===Ie.Top?e-t:o===Ie.Bottom?e+t:e}const fl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Ie.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:m0(t,e,i),cy:p0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};fl.props=["radius","centerX","centerY","position","type"],fl.compatConfig={MODE:3};const cd=fl,h0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:h,elementsSelectable:b,edgesUpdatable:g,edgesFocusable:_,hooks:N}=De(),y=n.computed(()=>u(e.id)),{emit:$,on:K}=db(y.value,l),F=n.inject(Ei),q=n.getCurrentInstance(),G=n.ref(!1),X=n.ref(!1),Q=n.ref(""),de=n.ref(null),B=n.ref("source"),ee=n.ref(null),v=n.toRef(()=>typeof y.value.selectable>"u"?b.value:y.value.selectable),R=n.toRef(()=>typeof y.value.updatable>"u"?g.value:y.value.updatable),E=n.toRef(()=>typeof y.value.focusable>"u"?_.value:y.value.focusable);n.provide(rb,e.id),n.provide(sb,ee);const P=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),W=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),oe=n.computed(()=>{const V=y.value.type||"default",H=F==null?void 0:F[`edge-${V}`];if(H)return H;let te=y.value.template??c.value[V];if(typeof te=="string"&&q){const ne=Object.keys(q.appContext.components);ne&&ne.includes(V)&&(te=n.resolveComponent(V,!1))}return te&&typeof te!="string"?te:(l.error(new qe(Ge.EDGE_TYPE_MISSING,te)),!1)}),{handlePointerDown:T}=jc({nodeId:Q,handleId:de,type:B,isValidConnection:p,edgeUpdaterType:B,onEdgeUpdate:he,onEdgeUpdateEnd:we});return()=>{const V=f(y.value.source),H=f(y.value.target),te="pathOptions"in y.value?y.value.pathOptions:{};if(!V&&!H)return l.error(new qe(Ge.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!V)return l.error(new qe(Ge.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!H)return l.error(new qe(Ge.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||V.hidden||H.hidden)return null;let ne;i.value===At.Strict?ne=V.handleBounds.source:ne=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const ge=Dc(ne,y.value.sourceHandle);let ve;i.value===At.Strict?ve=H.handleBounds.target:ve=[...H.handleBounds.target||[],...H.handleBounds.source||[]];const Ee=Dc(ve,y.value.targetHandle),w=(ge==null?void 0:ge.position)||Ie.Bottom,x=(Ee==null?void 0:Ee.position)||Ie.Top,{x:j,y:le}=Mn(V,ge,w),{x:_e,y:O}=Mn(H,Ee,x);return y.value.sourceX=j,y.value.sourceY=le,y.value.targetX=_e,y.value.targetY=O,n.h("g",{ref:ee,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${oe.value===!1?"default":y.value.type||"default"}`,s.value,P.value,{updating:G.value,selected:y.value.selected,animated:y.value.animated,inactive:!v.value&&!N.value.edgeClick.hasListeners()}],tabIndex:E.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":E.value?`${hc}-${t}`:void 0,"aria-roledescription":"edge",role:E.value?"group":"img",...y.value.domAttributes,onClick:me,onContextmenu:be,onDblclick:xe,onMouseenter:Ce,onMousemove:Se,onMouseleave:ye,onKeyDown:E.value?k:void 0},[X.value?null:n.h(oe.value===!1?c.value.default:oe.value,{id:e.id,sourceNode:V,targetNode:H,source:y.value.source,target:y.value.target,type:y.value.type,updatable:R.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...K},style:W.value,markerStart:`url('#${go(y.value.markerStart,t)}')`,markerEnd:`url('#${go(y.value.markerEnd,t)}')`,sourcePosition:w,targetPosition:x,sourceX:j,sourceY:le,targetX:_e,targetY:O,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...te}),[R.value==="source"||R.value===!0?[n.h("g",{onMousedown:Y,onMouseenter:J,onMouseout:se},n.h(cd,{position:w,centerX:j,centerY:le,radius:a.value,type:"source","data-type":"source"}))]:null,R.value==="target"||R.value===!0?[n.h("g",{onMousedown:C,onMouseenter:J,onMouseout:se},n.h(cd,{position:x,centerX:_e,centerY:O,radius:a.value,type:"target","data-type":"target"}))]:null]])};function J(){G.value=!0}function se(){G.value=!1}function he(V,H){$.update({event:V,edge:y.value,connection:H})}function we(V){$.updateEnd({event:V,edge:y.value}),X.value=!1}function re(V,H){V.button===0&&(X.value=!0,Q.value=H?y.value.target:y.value.source,de.value=(H?y.value.targetHandle:y.value.sourceHandle)??null,B.value=H?"target":"source",$.updateStart({event:V,edge:y.value}),T(V))}function me(V){var H;const te={event:V,edge:y.value};v.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(H=ee.value)==null||H.blur()):o([y.value])),$.click(te)}function be(V){$.contextMenu({event:V,edge:y.value})}function xe(V){$.doubleClick({event:V,edge:y.value})}function Ce(V){$.mouseEnter({event:V,edge:y.value})}function Se(V){$.mouseMove({event:V,edge:y.value})}function ye(V){$.mouseLeave({event:V,edge:y.value})}function Y(V){re(V,!0)}function C(V){re(V,!1)}function k(V){var H;!h.value&&yc.includes(V.key)&&v.value&&(V.key==="Escape"?((H=ee.value)==null||H.blur(),d([u(e.id)])):o([u(e.id)]))}}}),y0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:l,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=De(),p=(e=n.inject(Ei))==null?void 0:e["connection-line"],m=n.computed(()=>{var N;return f((N=i.value)==null?void 0:N.nodeId)}),h=n.computed(()=>{var N;return f((N=a.value)==null?void 0:N.nodeId)??null}),b=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),g=n.computed(()=>c.value.markerStart?`url(#${go(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${go(c.value.markerEnd,t)})`:"");return()=>{var N,y,$;if(!m.value||!i.value)return null;const K=i.value.id,F=i.value.type,q=m.value.handleBounds;let G=(q==null?void 0:q[F])??[];if(o.value===At.Loose){const W=(q==null?void 0:q[F==="source"?"target":"source"])??[];G=[...G,...W]}if(!G)return null;const X=(K?G.find(W=>W.id===K):G[0])??null,Q=(X==null?void 0:X.position)??Ie.Top,{x:de,y:B}=Mn(m.value,X,Q);let ee=null;h.value&&(o.value===At.Strict?ee=((N=h.value.handleBounds[F==="source"?"target":"source"])==null?void 0:N.find(W=>{var oe;return W.id===((oe=a.value)==null?void 0:oe.id)}))||null:ee=((y=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:y.find(W=>{var oe;return W.id===((oe=a.value)==null?void 0:oe.id)}))||null);const v=(($=a.value)==null?void 0:$.position)??(Q?ll[Q]:null);if(!Q||!v)return null;const R=r.value??c.value.type??rn.Bezier;let E="";const P={sourceX:de,sourceY:B,sourcePosition:Q,targetX:b.value.x,targetY:b.value.y,targetPosition:v};return R===rn.Bezier?[E]=od(P):R===rn.Step?[E]=ul({...P,borderRadius:0}):R===rn.SmoothStep?[E]=ul(P):R===rn.SimpleBezier?[E]=ad(P):E=`M${de},${B} ${b.value.x},${b.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},p?n.h(p,{sourceX:de,sourceY:B,sourcePosition:Q,targetX:b.value.x,targetY:b.value.y,targetPosition:v,sourceNode:m.value,sourceHandle:X,targetNode:h.value,targetHandle:ee,markerEnd:_.value,markerStart:g.value,connectionStatus:d.value}):n.h("path",{d:E,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":g.value})))}}}),g0=["id","markerWidth","markerHeight","markerUnits","orient"],b0={name:"MarkerType",compatConfig:{MODE:3}},_0=n.defineComponent({...b0,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Za).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Za).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,g0))}}),w0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},v0={name:"MarkerDefinitions",compatConfig:{MODE:3}},k0=n.defineComponent({...v0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=De(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=go(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),r.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(r,s)=>(n.openBlock(),n.createElementBlock("svg",w0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(_0,{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))])]))}}),E0={name:"Edges",compatConfig:{MODE:3}},N0=n.defineComponent({...E0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=De();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(k0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(Xg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(h0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(y0))],64))}}),$0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:h,ariaLiveMessage:b,snapToGrid:g,snapGrid:_,nodeDragThreshold:N,nodesDraggable:y,elementsSelectable:$,nodesConnectable:K,nodesFocusable:F,hooks:q}=De(),G=n.ref(null);n.provide(qc,G),n.provide(Kc,e.id);const X=n.inject(Ei),Q=n.getCurrentInstance(),de=Jc(),{node:B,parentNode:ee}=Zc(e.id),{emit:v,on:R}=pb(B,r),E=n.toRef(()=>typeof B.draggable>"u"?y.value:B.draggable),P=n.toRef(()=>typeof B.selectable>"u"?$.value:B.selectable),W=n.toRef(()=>typeof B.connectable>"u"?K.value:B.connectable),oe=n.toRef(()=>typeof B.focusable>"u"?F.value:B.focusable),T=n.computed(()=>P.value||E.value||q.value.nodeClick.hasListeners()||q.value.nodeDoubleClick.hasListeners()||q.value.nodeMouseEnter.hasListeners()||q.value.nodeMouseMove.hasListeners()||q.value.nodeMouseLeave.hasListeners()),J=n.toRef(()=>!!B.dimensions.width&&!!B.dimensions.height),se=n.computed(()=>{const H=B.type||"default",te=X==null?void 0:X[`node-${H}`];if(te)return te;let ne=B.template||f.value[H];if(typeof ne=="string"&&Q){const ge=Object.keys(Q.appContext.components);ge&&ge.includes(H)&&(ne=n.resolveComponent(H,!1))}return ne&&typeof ne!="string"?ne:(r.error(new qe(Ge.NODE_TYPE_MISSING,ne)),!1)}),he=Xc({id:e.id,el:G,disabled:()=>!E.value,selectable:P,dragHandle:()=>B.dragHandle,onStart(H){v.dragStart(H)},onDrag(H){v.drag(H)},onStop(H){v.dragStop(H)},onClick(H){k(H)}}),we=n.computed(()=>B.class instanceof Function?B.class(B):B.class),re=n.computed(()=>{const H=(B.style instanceof Function?B.style(B):B.style)||{},te=B.width instanceof Function?B.width(B):B.width,ne=B.height instanceof Function?B.height(B):B.height;return!H.width&&te&&(H.width=typeof te=="string"?te:`${te}px`),!H.height&&ne&&(H.height=typeof ne=="string"?ne:`${ne}px`),H}),me=n.toRef(()=>Number(B.zIndex??re.value.zIndex??0));return u(H=>{(H.includes(e.id)||!H.length)&&xe()}),n.onMounted(()=>{n.watch(()=>B.hidden,(H=!1,te,ne)=>{!H&&G.value&&(e.resizeObserver.observe(G.value),ne(()=>{G.value&&e.resizeObserver.unobserve(G.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>B.type,()=>B.sourcePosition,()=>B.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:G.value,forceUpdate:!0}])})}),n.watch([()=>B.position.x,()=>B.position.y,()=>{var H;return(H=ee.value)==null?void 0:H.computedPosition.x},()=>{var H;return(H=ee.value)==null?void 0:H.computedPosition.y},()=>{var H;return(H=ee.value)==null?void 0:H.computedPosition.z},me,()=>B.selected,()=>B.dimensions.height,()=>B.dimensions.width,()=>{var H;return(H=ee.value)==null?void 0:H.dimensions.height},()=>{var H;return(H=ee.value)==null?void 0:H.dimensions.width}],([H,te,ne,ge,ve,Ee])=>{const w={x:H,y:te,z:Ee+(m.value&&B.selected?1e3:0)};typeof ne<"u"&&typeof ge<"u"?B.computedPosition=Fg({x:ne,y:ge,z:ve},w):B.computedPosition=w},{flush:"post",immediate:!0}),n.watch([()=>B.extent,p],([H,te],[ne,ge])=>{(H!==ne||te!==ge)&&be()}),B.extent==="parent"||typeof B.extent=="object"&&"range"in B.extent&&B.extent.range==="parent"?Ca(()=>J).toBe(!0).then(be):be(),()=>B.hidden?null:n.h("div",{ref:G,"data-id":B.id,class:["vue-flow__node",`vue-flow__node-${se.value===!1?"default":B.type||"default"}`,{[o.value]:E.value,dragging:he==null?void 0:he.value,draggable:E.value,selected:B.selected,selectable:P.value,parent:B.isParent},we.value],style:{visibility:J.value?"visible":"hidden",zIndex:B.computedPosition.z??me.value,transform:`translate(${B.computedPosition.x}px,${B.computedPosition.y}px)`,pointerEvents:T.value?"all":"none",...re.value},tabIndex:oe.value?0:void 0,role:oe.value?"group":void 0,"aria-describedby":h.value?void 0:`${pc}-${t}`,"aria-label":B.ariaLabel,"aria-roledescription":"node",...B.domAttributes,onMouseenter:Ce,onMousemove:Se,onMouseleave:ye,onContextmenu:Y,onClick:k,onDblclick:C,onKeydown:V},[n.h(se.value===!1?f.value.default:se.value,{id:B.id,type:B.type,data:B.data,events:{...B.events,...R},selected:B.selected,resizing:B.resizing,dragging:he.value,connectable:W.value,position:B.computedPosition,dimensions:B.dimensions,isValidTargetPos:B.isValidTargetPos,isValidSourcePos:B.isValidSourcePos,parent:B.parentNode,parentNodeId:B.parentNode,zIndex:B.computedPosition.z??me.value,targetPosition:B.targetPosition,sourcePosition:B.sourcePosition,label:B.label,dragHandle:B.dragHandle,onUpdateNodeInternals:xe})]);function be(){const H=B.computedPosition,{computedPosition:te,position:ne}=ol(B,g.value?ki(H,_.value):H,r.error,p.value,ee.value);(B.computedPosition.x!==te.x||B.computedPosition.y!==te.y)&&(B.computedPosition={...B.computedPosition,...te}),(B.position.x!==ne.x||B.position.y!==ne.y)&&(B.position=ne)}function xe(){G.value&&d([{id:e.id,nodeElement:G.value,forceUpdate:!0}])}function Ce(H){he!=null&&he.value||v.mouseEnter({event:H,node:B})}function Se(H){he!=null&&he.value||v.mouseMove({event:H,node:B})}function ye(H){he!=null&&he.value||v.mouseLeave({event:H,node:B})}function Y(H){return v.contextMenu({event:H,node:B})}function C(H){return v.doubleClick({event:H,node:B})}function k(H){P.value&&(!i.value||!E.value||N.value>0)&&rl(B,l.value,c,s,a,!1,G.value),v.click({event:H,node:B})}function V(H){if(!(Ja(H)||h.value))if(yc.includes(H.key)&&P.value){const te=H.key==="Escape";rl(B,l.value,c,s,a,te,G.value)}else E.value&&B.selected&&An[H.key]&&(H.preventDefault(),b.value=`Moved selected node ${H.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~B.position.x}, y: ${~~B.position.y}`,de({x:An[H.key].x,y:An[H.key].y},H.shiftKey))}}});function x0(e={includeHiddenNodes:!1}){const{nodes:t}=De();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const I0={class:"vue-flow__nodes vue-flow__container"},S0={name:"Nodes",compatConfig:{MODE:3}},C0=n.defineComponent({...S0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=De(),a=x0(),l=n.ref();return n.watch(a,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{l.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=l.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",I0,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const p=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,p))return f;const m=(n.openBlock(),n.createBlock(n.unref($0),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):n.createCommentVNode("",!0)]))}});function R0(){const{emits:e}=De();n.onMounted(()=>{if(Uc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new qe(Ge.MISSING_STYLES))}})}const V0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),A0={name:"VueFlow",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const i=e,a=n.useSlots(),l=Ra(i,"modelValue",o),r=Ra(i,"nodes",o),s=Ra(i,"edges",o),c=De(i),d=bb({modelValue:l,nodes:r,edges:s},i,c);return wb(o,c.hooks),f0(),R0(),n.provide(Ei,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(l0,null,{default:n.withCtx(()=>[n.createVNode(N0),V0,n.createVNode(C0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(u0)],512))}}),M0={name:"Panel",compatConfig:{MODE:3}},dd=n.defineComponent({...M0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=De(),i=n.computed(()=>`${t.position}`.split("-"));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),mn=["red","amber","green","teal","blue","indigo","violet","pink"],ud={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function B0(e){return typeof e=="string"&&e in ud}const D0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},O0=.15;function L0(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,l=parseInt(o.slice(4,6),16)/255,r=Math.max(i,a,l),s=Math.min(i,a,l),c=r-s,d=(r+s)/2;let u=0,f=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),r===i?f=(a-l)/c%6:r===a?f=(l-i)/c+2:f=(i-a)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function P0(e){if(typeof e!="string")return null;const t=L0(e);if(!t||t.s<O0)return null;let o=null,i=1/0;for(const a of mn){const l=Math.abs(t.h-D0[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function Qe(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(B0(t))return t;const o=e==null?void 0:e.properties;return P0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function ml(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const z0={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)"},U0={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 fd(e,t=!1){return e?t?U0[e]:z0[e]:null}function Bn(e){return ud[e]}function Dn(e){return`var(--em-swatch-${e}-bar)`}const H0=["width","height","innerHTML"],F0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',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"/>',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"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,H0))}}),Le=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Le(F0,[["__scopeId","data-v-5256c2f6"]]),G0={class:"em-inline-issue__msgs"},pn=Le(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),a=n.computed(()=>{let l=null;for(const r of i.value)(l===null||o[r.severity].order<o[l].order)&&(l=r.severity);return l});return(l,r)=>a.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${a.value}`])},[n.createVNode(Ve,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",G0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,c)=>(n.openBlock(),n.createElementBlock("span",{key:c},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),Y0={class:"em-mlang"},W0={class:"em-mlang__tabs",role:"tablist"},K0=["aria-selected","onClick"],q0={key:0,class:"em-mlang__dot"},pl=Le(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const l=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function r(d){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[d])!=null&&f.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[l.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[l.value]:u[l.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",Y0,[n.createElementVNode("div",W0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":l.value===f}]),role:"tab","aria-selected":l.value===f,onClick:p=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",q0,"•")):n.createCommentVNode("",!0)],10,K0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ae.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),X0=["disabled"],j0={class:"em-panel__sub-label"},Z0={class:"em-field"},J0={class:"em-field"},Q0={class:"em-field"},e1={class:"em-class"},t1={class:"em-field"},n1={class:"em-field"},o1={class:"em-field"},i1={class:"em-field"},a1={class:"em-multilang"},l1={class:"em-multilang"},r1={class:"em-jpa"},s1={class:"em-field"},c1={class:"em-field"},d1={class:"em-field"},u1={class:"em-swatch"},f1={class:"em-swatch__row"},m1=["title","onClick"],md=Le(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(B=>B.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(B=>B.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var B;return Qe(((B=r.value)==null?void 0:B.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=B=>B;function p(B){return B==="inherit"?"기본(따름)":B}function m(B){l.value&&a.updateEntity(l.value.modelId,B)}function h(B,ee,v){var E;const R=((E=l.value)==null?void 0:E.table)??{physicalName:""};m(B==="physicalName"?{table:{...R,physicalName:v}}:{table:{...R,logicalName:{...R.logicalName,[ee]:v}}})}function b(B){m({description:Object.keys(B).length?B:void 0})}function g(B,ee){var v;m({jpaAttrs:{...(v=l.value)==null?void 0:v.jpaAttrs,[B]:ee}})}function _(B,ee){g(B,ee)}const N=n.computed(()=>{var B,ee;return((ee=(B=l.value)==null?void 0:B.jpaAttrs)==null?void 0:ee.discriminatorType)??"inherit"}),y=n.computed(()=>{var B,ee;return!((ee=(B=l.value)==null?void 0:B.jpaAttrs)!=null&&ee.useDiscriminator)});function $(B){g("discriminatorType",B==="inherit"?void 0:B)}function K(B){m({hasPersonalInfo:B})}function F(B){m({superClass:B.trim()||void 0})}function q(B){m({schema:B.trim()||void 0})}function G(B){m({abstractClass:B})}const X=n.computed(()=>{var B,ee;return((ee=(B=l.value)==null?void 0:B.declarationOfInterfaces)==null?void 0:ee.join(", "))??""});function Q(B){const ee=B.split(",").map(v=>v.trim()).filter(Boolean);m({declarationOfInterfaces:ee.length?ee:void 0})}function de(B){l.value&&a.setEntitySwatch(l.value.modelId,B)}return(B,ee)=>{var v,R,E;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:ee[0]||(ee[0]=P=>i("toggle"))},[n.createElementVNode("span",j0,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||l.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(pn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",Z0,[ee[13]||(ee[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":ee[1]||(ee[1]=P=>m({name:P}))},null,8,["model-value"])]),n.createElementVNode("label",J0,[ee[14]||(ee[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":ee[2]||(ee[2]=P=>m({stereotype:P}))},null,8,["model-value"])]),n.createElementVNode("label",Q0,[ee[15]||(ee[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":ee[3]||(ee[3]=P=>m({packageName:P}))},null,8,["model-value"])]),n.createElementVNode("fieldset",e1,[ee[18]||(ee[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",t1,[ee[16]||(ee[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":ee[4]||(ee[4]=P=>F(P))},null,8,["model-value"])]),n.createElementVNode("label",n1,[ee[17]||(ee[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":X.value,"onUpdate:modelValue":ee[5]||(ee[5]=P=>Q(P))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":ee[6]||(ee[6]=P=>G(P))},null,8,["model-value"])]),n.createElementVNode("label",o1,[ee[19]||(ee[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((v=l.value.table)==null?void 0:v.physicalName)??"","onUpdate:modelValue":ee[7]||(ee[7]=P=>h("physicalName",null,P))},null,8,["model-value"])]),n.createElementVNode("label",i1,[ee[20]||(ee[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":ee[8]||(ee[8]=P=>q(P))},null,8,["model-value"])]),n.createElementVNode("fieldset",a1,[ee[21]||(ee[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,P=>{var W,oe;return n.openBlock(),n.createElementBlock("label",{key:P,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(P),1),n.createVNode(n.unref(ae.BSTextInput),{name:`ent-logical-${P}`,width:"100%","model-value":((oe=(W=l.value.table)==null?void 0:W.logicalName)==null?void 0:oe[P])??"","onUpdate:modelValue":T=>h("logicalName",P,T)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",l1,[ee[22]||(ee[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(pl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",r1,[ee[26]||(ee[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,P=>{var W;return n.createVNode(n.unref(ae.BSCheckbox),{key:P.key,name:`jpa-${P.key}`,class:"em-check",label:P.label,"model-value":!!((W=l.value.jpaAttrs)!=null&&W[P.key]),"onUpdate:modelValue":oe=>_(P.key,oe)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",s1,[ee[23]||(ee[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((R=l.value.jpaAttrs)==null?void 0:R.discriminatorColumnName)??"","onUpdate:modelValue":ee[9]||(ee[9]=P=>g("discriminatorColumnName",P.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",c1,[ee[24]||(ee[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:y.value,"model-value":N.value,items:u,"value-provider":f,"label-provider":p,"onUpdate:modelValue":ee[10]||(ee[10]=P=>P&&$(P))},null,8,["disabled","model-value"])]),n.createElementVNode("label",d1,[ee[25]||(ee[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":(E=l.value.jpaAttrs)==null?void 0:E.discriminatorLength,"onUpdate:modelValue":ee[11]||(ee[11]=P=>g("discriminatorLength",P||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":K},null,8,["model-value"]),n.createElementVNode("fieldset",u1,[ee[27]||(ee[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",f1,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:ee[12]||(ee[12]=P=>de(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),P=>(n.openBlock(),n.createElementBlock("button",{key:P,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===P}]),style:n.normalizeStyle({background:n.unref(Dn)(P)}),title:n.unref(Bn)(P),onClick:W=>de(P)},null,14,m1))),128))])])],64)):n.createCommentVNode("",!0)],8,X0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),pd=["ko","en","ja","zh"];function p1(e){if(e)for(const t of pd){const o=e[t];if(o)return o}}function hl(e){const t=p1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function h1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:pd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const y1=["aria-expanded"],g1=["aria-selected","onClick","onMouseenter"],b1={key:0,class:"gcc__opt gcc__opt--empty"},hd=Le(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref(),l=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(G=>G.groupCode===o.modelValue)),p=n.computed(()=>f.value?hl(f.value):"");n.watch(p,G=>{c.value||(s.value=G)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:h1(o.items,s.value));function h(){var X;const G=(X=a.value)==null?void 0:X.getBoundingClientRect();G&&(u.value={left:`${G.left}px`,top:`${G.bottom}px`,width:`${G.width}px`})}function b(){c.value=!0,h(),d.value=Math.max(0,m.value.findIndex(G=>G.groupCode===o.modelValue)),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),document.addEventListener("mousedown",q)}function g(){c.value=!1,window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),document.removeEventListener("mousedown",q)}n.onBeforeUnmount(g);function _(){b(),n.nextTick(()=>{var G;return(G=l.value)==null?void 0:G.select()})}function N(){c.value||b(),d.value=0}function y(G){i("update:modelValue",G.groupCode),s.value=hl(G),g()}function $(){i("update:modelValue",void 0),s.value="",g()}function K(){s.value.trim()===""?$():(s.value=p.value,g())}function F(G){var X;if(G.key==="ArrowDown")c.value||b(),d.value=Math.min(d.value+1,m.value.length-1),G.preventDefault();else if(G.key==="ArrowUp")d.value=Math.max(d.value-1,0),G.preventDefault();else if(G.key==="Enter"){const Q=m.value[d.value];Q&&y(Q),G.preventDefault()}else G.key==="Escape"&&(s.value=p.value,g(),(X=l.value)==null||X.blur())}function q(G){var Q,de;const X=G.target;!((Q=a.value)!=null&&Q.contains(X))&&!((de=r.value)!=null&&de.contains(X))&&K()}return(G,X)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":X[0]||(X[0]=Q=>s.value=Q),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:N,onKeydown:F},null,40,y1),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[c.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:X[1]||(X[1]=n.withModifiers(()=>{},["prevent"])),onClick:$},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(Q,de)=>(n.openBlock(),n.createElementBlock("li",{key:Q.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":de===d.value,"is-selected":Q.groupCode===e.modelValue}]),role:"option","aria-selected":Q.groupCode===e.modelValue,onMousedown:X[2]||(X[2]=n.withModifiers(()=>{},["prevent"])),onClick:B=>y(Q),onMouseenter:B=>d.value=de},n.toDisplayString(n.unref(hl)(Q)),43,g1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",b1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),_1=["disabled"],w1={class:"em-aw__toolbar"},v1={class:"em-aw__count"},k1={class:"em-aw__scroll"},E1={class:"em-aw__table"},N1={key:0,class:"c-code"},$1=["colspan"],x1={class:"c-del"},I1={class:"c-flag"},S1={class:"c-flag"},C1={class:"c-flag"},R1={class:"c-flag"},V1={class:"c-flag"},A1={class:"c-flag"},T1={class:"c-flag"},M1={class:"c-flag"},B1={key:0},D1={class:"c-del"},O1=["colspan"],L1={class:"c-del"},P1={class:"em-aw__embed-label"},z1={class:"em-aw__ro"},U1={class:"em-aw__ro"},H1={class:"em-aw__ro"},F1={class:"em-aw__ro"},G1={colspan:"8"},Y1=["colspan"],W1={key:0},Vi="__OWN__",K1=Le(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(O=>O.modelId===t.entityId)??null),a=n.computed(()=>{var O;return((O=i.value)==null?void 0:O.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var O;return(((O=i.value)==null?void 0:O.attributes)??[]).filter(U=>U.attrType!=="DIVIDER").length}),s=n.computed(()=>v.value.length?19:18),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(O){return O==="none"?"(없음)":O}const u=O=>O;function f(O,U){i.value&&o.updateAttribute(i.value.modelId,O.modelId,U)}function p(O,U){f(O,{naturalId:U||void 0,naturalIdMutable:U?O.naturalIdMutable:void 0})}function m(){return{naturalId:void 0,naturalIdMutable:void 0}}function h(O,U){f(O,{identifier:U,...U?m():{}})}function b(O,U){f(O,{transient:U||void 0,...U?m():{}})}function g(O){return!!O.transient}const _=O=>O.value,N=O=>O.label;function y(O,U){if(!U)return;const M=Q.value.find(pe=>pe.type===U);if(M){const pe=O.dbAttrs[0]??{modelId:O.modelId+".c",physicalName:O.name,dataType:"VARCHAR"};f(O,{type:U,customType:void 0,dbAttrs:[{...pe,dataType:M.dataType,length:M.length,scale:M.scale}]});return}f(O,U===Ot?{type:U}:{type:U,customType:void 0})}function $(O,U){f(O,{customType:U.trim()===""?void 0:U})}function K(O,U){const pe={...O.dbAttrs[0]??{modelId:O.modelId+".c",physicalName:O.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!Lo.has(pe.dataType)&&(pe.scale=void 0),f(O,{dbAttrs:[pe]})}function F(O){var U;return Lo.has(((U=O.dbAttrs[0])==null?void 0:U.dataType)??"")}function q(O,U,M){var pe;K(O,{logicalName:{...(pe=O.dbAttrs[0])==null?void 0:pe.logicalName,[U]:M}})}function G(O){return O.personalInfoAttributeType??"none"}function X(O,U){f(O,{personalInfoAttributeType:U==="none"?void 0:U})}const Q=n.computed(()=>o.predefinedCustomTypeCatalog.value),de=n.computed(()=>o.embeddableCatalog.value);function B(O){var U,M;return((U=O.label)==null?void 0:U.ko)??((M=O.label)==null?void 0:M.en)??O.type}function ee(O){!O||!i.value||o.addPredefinedEmbed(i.value.modelId,O)}const v=n.computed(()=>o.groupCodeCatalog.value);function R(O){var U;return((U=v.value.find(M=>M.groupCode===O.groupCode))==null?void 0:U.codes)??[]}function E(O){return["none",...R(O)]}function P(O){return O==="none"?"none":O.code}function W(O){var M,pe;if(O==="none")return"(없음)";const U=((M=O.label)==null?void 0:M.ko)??((pe=O.label)==null?void 0:pe.en);return U?`${O.code} (${U})`:O.code}function oe(O,U){i.value&&o.setAttributeGroupCode(i.value.modelId,O.modelId,U)}function T(O,U){f(O,{defaultValue:U==="none"?void 0:U})}function J(O,U){f(O,{defaultValue:U.trim()===""?void 0:U})}function se(O){return O.attrType.startsWith("EMBED")&&O.dbAttrs.length>0}function he(O,U,M){const pe=O.dbAttrs.map((S,D)=>{if(D!==U)return S;const I={...S,...M};for(const L of Object.keys(M))M[L]===void 0&&delete I[L];return I});i.value&&o.setEmbedColumns(i.value.modelId,O.modelId,pe)}function we(O,U,M,pe){var S;he(O,U,{logicalName:{...(S=O.dbAttrs[U])==null?void 0:S.logicalName,[M]:pe}})}function re(O,U){var S,D,I;if(O.attrType==="EMBED_PREDEF"){const L=(S=o.embeddableCatalog.value.find(ie=>ie.type===O.type))==null?void 0:S.fields[U];return L?{name:L.name,physicalName:L.physicalName,dataType:L.dataType,length:L.length,shareable:L.shareable,logicalName:L.logicalName}:void 0}const M=(D=O.embedded)==null?void 0:D.embeddableRef;if(!M)return;const pe=(I=o.state.logical.entities.find(L=>L.modelId===M))==null?void 0:I.attributes.flatMap(L=>L.dbAttrs)[U];return pe?{physicalName:pe.physicalName,dataType:pe.dataType,length:pe.length,scale:pe.scale,logicalName:pe.logicalName}:void 0}function me(O,U){var M,pe;return((M=re(O,U))==null?void 0:M.dataType)||((pe=O.dbAttrs[U])==null?void 0:pe.dataType)||""}function be(O,U){var M,pe;return((M=re(O,U))==null?void 0:M.length)??((pe=O.dbAttrs[U])==null?void 0:pe.length)}function xe(O,U){var M,pe;return((M=re(O,U))==null?void 0:M.scale)??((pe=O.dbAttrs[U])==null?void 0:pe.scale)}const Ce=["inherit","true","false"];function Se(O){return O==="inherit"?"기본(따름)":O}function ye(O){return(O==null?void 0:O.updatable)===void 0?"inherit":O.updatable?"true":"false"}function Y(O,U,M){he(O,U,{updatable:M==="inherit"?void 0:M==="true"})}function C(O,U){K(O,{updatable:U==="inherit"?void 0:U==="true"})}const k=["inherit","true","false"];function V(O){return O==="inherit"?"기본(따름)":O}function H(O){return(O==null?void 0:O.insertable)===void 0?"inherit":O.insertable?"true":"false"}function te(O,U,M){he(O,U,{insertable:M==="inherit"?void 0:M==="true"})}function ne(O,U){K(O,{insertable:U==="inherit"?void 0:U==="true"})}const ge=n.computed(()=>{var O;return Wn(((O=i.value)==null?void 0:O.attributes.flatMap(U=>U.dbAttrs))??[])}),ve=n.computed(()=>{var O;return(((O=i.value)==null?void 0:O.attributes)??[]).filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>({modelId:U.dbAttrs[0].modelId,label:U.dbAttrs[0].physicalName||U.name}))});function Ee(){return[Vi,...ve.value.map(O=>O.modelId)]}function w(O){if(O===Vi)return"전용 컬럼(OWN)";const U=ve.value.find(M=>M.modelId===O);return U?`↗ ${U.label} (공유)`:O}function x(O){return(O==null?void 0:O.sharedColumnRef)??Vi}function j(O,U,M){he(O,U,{sharedColumnRef:M===Vi?void 0:M})}function le(O){return(O==null?void 0:O.sharedColumnRef)!=null}function _e(O){var U;return((U=Po(O,ge.value))==null?void 0:U.physicalName)??""}return(O,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",w1,[n.createElementVNode("span",v1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:U[0]||(U[0]=M=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:U[1]||(U[1]=M=>n.unref(o).addDivider(i.value.modelId))}),de.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:de.value,"value-provider":M=>M.type,"label-provider":B,"onUpdate:modelValue":ee},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",k1,[n.createElementVNode("table",E1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[U[2]||(U[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),U[3]||(U[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),U[4]||(U[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),U[5]||(U[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),U[6]||(U[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),U[7]||(U[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),U[8]||(U[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),U[9]||(U[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),U[10]||(U[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),U[11]||(U[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),U[12]||(U[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),U[13]||(U[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),U[14]||(U[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),U[15]||(U[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),U[16]||(U[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),U[17]||(U[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),U[18]||(U[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),U[19]||(U[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),v.value.length?(n.openBlock(),n.createElementBlock("th",N1,"코드그룹")):n.createCommentVNode("",!0),U[20]||(U[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),U[21]||(U[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,M=>{var pe,S,D,I,L,ie,ue,fe,A,Z,z;return n.openBlock(),n.createElementBlock(n.Fragment,{key:M.modelId},[M.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(M.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${M.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":M.name,"onUpdate:modelValue":ce=>f(M,{name:ce})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,$1),n.createElementVNode("td",x1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ce=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])])],2)):se(M)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(M.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${M.modelId}`,width:"100%",placeholder:"이름","model-value":M.name,"onUpdate:modelValue":ce=>f(M,{name:ce})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${M.modelId}`,width:"100%",disabled:"","model-value":M.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:v.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(M.dbAttrs.length)+"개",9,O1),n.createElementVNode("td",L1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ce=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.dbAttrs,(ce,Ae)=>{var Ue,Oe,Me,st,Xt,jt,Zt;return n.openBlock(),n.createElementBlock("tr",{key:ce.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",P1,"↳ "+n.toDisplayString(((Ue=re(M,Ae))==null?void 0:Ue.name)??((Oe=re(M,Ae))==null?void 0:Oe.physicalName)??`컬럼 ${Ae+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",z1,n.toDisplayString(me(M,Ae)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${ce.modelId}`,width:"100%",placeholder:((st=(Me=re(M,Ae))==null?void 0:Me.logicalName)==null?void 0:st.ko)??"논리명","model-value":((Xt=ce.logicalName)==null?void 0:Xt.ko)??"","onUpdate:modelValue":Xe=>we(M,Ae,"ko",Xe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${ce.modelId}`,width:"100%",disabled:le(ce),placeholder:((jt=re(M,Ae))==null?void 0:jt.physicalName)??"컬럼","model-value":le(ce)?_e(ce):ce.physicalName,"onUpdate:modelValue":Xe=>he(M,Ae,{physicalName:Xe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":ce.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",U1,n.toDisplayString(me(M,Ae)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",H1,n.toDisplayString(be(M,Ae)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",F1,n.toDisplayString(xe(M,Ae)??""),1)]),n.createElementVNode("td",G1,[(Zt=re(M,Ae))!=null&&Zt.shareable?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":x(ce),items:Ee(),"value-provider":u,"label-provider":w,"onUpdate:modelValue":Xe=>Xe&&j(M,Ae,Xe)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:le(ce),"model-value":le(ce)?"false":H(ce),items:k,"value-provider":u,"label-provider":V,"onUpdate:modelValue":Xe=>Xe&&te(M,Ae,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:le(ce),"model-value":le(ce)?"false":ye(ce),items:Ce,"value-provider":u,"label-provider":Se,"onUpdate:modelValue":Xe=>Xe&&Y(M,Ae,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:v.value.length?4:3},null,8,Y1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(M.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${M.modelId}`,width:"100%",placeholder:"이름","model-value":M.name,"onUpdate:modelValue":ce=>f(M,{name:ce})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${M.modelId}`,width:"100%",placeholder:"타입",disabled:!!M.groupCode,items:n.unref(er)(M.type,Q.value),"value-provider":_,"label-provider":N,"model-value":M.type,"onUpdate:modelValue":ce=>y(M,ce)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),M.type===n.unref(Ot)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${M.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":M.customType??"","onUpdate:modelValue":ce=>$(M,ce)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${M.modelId}`,width:"100%",placeholder:"논리명","model-value":((S=(pe=M.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:S.ko)??"","onUpdate:modelValue":ce=>q(M,"ko",ce)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${M.modelId}`,width:"100%",placeholder:"컬럼",disabled:g(M),"model-value":((D=M.dbAttrs[0])==null?void 0:D.physicalName)??"","onUpdate:modelValue":ce=>K(M,{physicalName:ce})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":(I=M.dbAttrs[0])==null?void 0:I.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${M.modelId}`,width:"100%",placeholder:"dataType",disabled:g(M),items:n.unref(Jl)(((L=M.dbAttrs[0])==null?void 0:L.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(ca),"model-value":((ie=M.dbAttrs[0])==null?void 0:ie.dataType)??"","onUpdate:modelValue":ce=>ce&&K(M,{dataType:ce})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${M.modelId}`,width:"100%",placeholder:"len",disabled:g(M),"model-value":(ue=M.dbAttrs[0])==null?void 0:ue.length,"onUpdate:modelValue":ce=>K(M,{length:ce||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${M.modelId}`,width:"100%",placeholder:"scale",disabled:g(M)||!F(M),"model-value":(fe=M.dbAttrs[0])==null?void 0:fe.scale,"onUpdate:modelValue":ce=>K(M,{scale:ce||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",I1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${M.modelId}`,"model-value":M.identifier,disabled:a.value||g(M),"onUpdate:modelValue":ce=>h(M,ce)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",S1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${M.modelId}`,"model-value":M.notNull,disabled:g(M),"onUpdate:modelValue":ce=>f(M,{notNull:ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",C1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${M.modelId}`,"model-value":!!((A=M.dbAttrs[0])!=null&&A.unique),disabled:g(M),"onUpdate:modelValue":ce=>K(M,{unique:ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",R1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${M.modelId}`,"model-value":!!((Z=M.dbAttrs[0])!=null&&Z.autoIncrement),disabled:g(M)||!M.identifier,"onUpdate:modelValue":ce=>K(M,{autoIncrement:ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",V1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${M.modelId}`,"model-value":!!M.transient,disabled:M.identifier,"onUpdate:modelValue":ce=>b(M,ce)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",A1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nid-${M.modelId}`,"model-value":!!M.naturalId,disabled:M.identifier||g(M),"onUpdate:modelValue":ce=>p(M,ce)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",T1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nidm-${M.modelId}`,"model-value":!!M.naturalIdMutable,disabled:g(M)||!M.naturalId,"onUpdate:modelValue":ce=>f(M,{naturalIdMutable:ce||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",M1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${M.modelId}`,"model-value":!!((z=M.dbAttrs[0])!=null&&z.multiValue),disabled:g(M),"onUpdate:modelValue":ce=>K(M,{multiValue:ce||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${M.modelId}`,width:"100%",disabled:g(M),"model-value":H(M.dbAttrs[0]),items:k,"value-provider":u,"label-provider":V,"onUpdate:modelValue":ce=>ce&&ne(M,ce)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${M.modelId}`,width:"100%",disabled:g(M),"model-value":ye(M.dbAttrs[0]),items:Ce,"value-provider":u,"label-provider":Se,"onUpdate:modelValue":ce=>ce&&C(M,ce)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":G(M),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ce=>ce&&X(M,ce)},null,8,["model-value","onUpdate:modelValue"])]),v.value.length?(n.openBlock(),n.createElementBlock("td",B1,[n.createVNode(hd,{"model-value":M.groupCode,items:v.value,"onUpdate:modelValue":ce=>oe(M,ce)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[R(M).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":M.defaultValue??"none",items:E(M),"value-provider":P,"label-provider":W,"onUpdate:modelValue":ce=>ce&&T(M,ce)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${M.modelId}`,width:"100%",placeholder:"기본값","model-value":M.defaultValue??"","onUpdate:modelValue":ce=>J(M,ce)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",D1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ce=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",W1,[...U[22]||(U[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,_1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-d8326b9d"]]),q1=["disabled"],X1={class:"em-idxw__list"},j1={class:"em-idxw__list-head"},Z1=["onClick"],J1={class:"em-idxw__item-name"},Q1={key:0,class:"em-idxw__badge"},e_={class:"em-idxw__item-cnt"},t_={key:0,class:"em-idxw__empty"},n_={key:0,class:"em-idxw__edit"},o_={class:"em-idxw__form"},i_={class:"em-field em-idxw__name"},a_={class:"em-field"},l_=["value"],r_={class:"em-idxw__transfer"},s_={class:"em-idxw__pane"},c_={class:"em-idxw__pane-head"},d_={class:"em-idxw__cols"},u_=["onClick"],f_={key:0,class:"em-idxw__empty"},m_={class:"em-idxw__arrows"},p_={class:"em-idxw__pane"},h_={class:"em-idxw__pane-head"},y_={class:"em-idxw__cols"},g_={class:"em-idxw__col-name"},b_={class:"em-idxw__col-ops"},__=["disabled","onClick"],w_=["disabled","onClick"],v_=["onClick"],k_={key:0,class:"em-idxw__empty"},E_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},N_=Le(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(F=>F.modelId===t.entityId)??null),a=n.computed(()=>{var F;return((F=i.value)==null?void 0:F.indexes)??[]}),l=n.computed(()=>{var F;return((F=i.value)==null?void 0:F.attributes)??[]}),r=n.ref(null);n.watch(a,F=>{var q;F.some(G=>G.modelId===r.value)||(r.value=((q=F[0])==null?void 0:q.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(F=>F.modelId===r.value)??null),c=n.computed(()=>{var F;return new Set(((F=s.value)==null?void 0:F.columns.map(q=>q.columnRef))??[])}),d=n.computed(()=>l.value.filter(F=>!c.value.has(F.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(F){var G;const q=(G=F.dbAttrs[0])==null?void 0:G.physicalName;return q&&q!==F.name?`${F.name} (${q})`:F.name}function p(F){const q=l.value.find(G=>G.modelId===F);return q?f(q):F}function m(F,q){i.value&&o.updateIndex(i.value.modelId,F,q)}function h(){var q;if(!i.value)return;const F=Te();o.addIndex(i.value.modelId,{modelId:F,name:`idx_${(((q=i.value.indexes)==null?void 0:q.length)??0)+1}`,unique:!1,columns:[]}),r.value=F}function b(F){i.value&&o.removeIndex(i.value.modelId,F)}function g(F){s.value&&m(s.value.modelId,{parameters:F.trim()===""?void 0:F})}function _(F){const q=new Set(u.value);q.has(F)?q.delete(F):q.add(F),u.value=q}function N(){const F=s.value;if(!F||!u.value.size)return;const q=[...u.value].map(G=>({columnRef:G,descending:!1}));m(F.modelId,{columns:[...F.columns,...q]}),u.value=new Set}function y(F){const q=s.value;q&&m(q.modelId,{columns:q.columns.filter((G,X)=>X!==F)})}function $(F,q){const G=s.value;G&&m(G.modelId,{columns:G.columns.map((X,Q)=>Q===F?{...X,descending:q}:X)})}function K(F,q){const G=s.value;if(!G)return;const X=F+q;if(X<0||X>=G.columns.length)return;const Q=[...G.columns];[Q[F],Q[X]]=[Q[X],Q[F]],m(G.modelId,{columns:Q})}return(F,q)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",X1,[n.createElementVNode("div",j1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:h})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,G=>(n.openBlock(),n.createElementBlock("li",{key:G.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":G.modelId===r.value}]),onClick:X=>r.value=G.modelId},[n.createElementVNode("span",J1,n.toDisplayString(G.name||"(이름 없음)"),1),G.unique?(n.openBlock(),n.createElementBlock("span",Q1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",e_,n.toDisplayString(G.columns.length),1)],10,Z1))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",t_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",n_,[n.createElementVNode("div",o_,[n.createElementVNode("label",i_,[q[4]||(q[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":q[0]||(q[0]=G=>m(s.value.modelId,{name:G}))},null,8,["model-value"]),n.createVNode(pn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":q[1]||(q[1]=G=>m(s.value.modelId,{unique:G}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:q[2]||(q[2]=G=>b(s.value.modelId))})]),n.createElementVNode("label",a_,[q[5]||(q[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:q[3]||(q[3]=G=>g(G.target.value))},null,40,l_)]),n.createElementVNode("div",r_,[n.createElementVNode("div",s_,[n.createElementVNode("div",c_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",d_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,G=>(n.openBlock(),n.createElementBlock("li",{key:G.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(G.modelId)}]),onClick:X=>_(G.modelId)},n.toDisplayString(f(G)),11,u_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",f_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",m_,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:N},null,8,["disabled"])]),n.createElementVNode("div",p_,[n.createElementVNode("div",h_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",y_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(G,X)=>(n.openBlock(),n.createElementBlock("li",{key:X,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",g_,n.toDisplayString(p(G.columnRef)),1),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${X}`,class:"em-check",label:"DESC","model-value":G.descending,"onUpdate:modelValue":Q=>$(X,Q)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",b_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:X===0,onClick:Q=>K(X,-1)},"↑",8,__),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:X===s.value.columns.length-1,onClick:Q=>K(X,1)},"↓",8,w_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:Q=>y(X)},"✕",8,v_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",k_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",E_,"인덱스를 선택하거나 추가하세요."))],8,q1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),$_={class:"em-op-src"},x_={class:"em-op-src__actions"},yd=Le(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",$_,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",x_,[n.createVNode(n.unref(ae.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),I_=["disabled"],S_={class:"em-ow__toolbar"},C_={class:"em-ow__count"},R_={class:"em-ow__scroll"},V_={class:"em-ow__table"},A_={class:"c-del"},T_={key:0},M_=Le(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModal(),a=n.computed(()=>o.state.logical.entities.find(h=>h.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(h){return h==="none"?"(없음)":h}const c=h=>h;function d(h,b){a.value&&o.updateOperation(a.value.modelId,h.modelId,b)}function u(h,b,g){d(h,{description:{...h.description,[b]:g}})}function f(h){return h.personalInfoAttributeType??"none"}function p(h,b){d(h,{personalInfoAttributeType:b==="none"?void 0:b})}function m(h){i.openModal({component:yd,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:b=>d(h,{sourceCode:b})}})}return(h,b)=>{var g,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",S_,[n.createElementVNode("span",C_,"오퍼레이션 ("+n.toDisplayString(((g=a.value.operations)==null?void 0:g.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:b[0]||(b[0]=N=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",R_,[n.createElementVNode("table",V_,[b[2]||(b[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":N.name,"onUpdate:modelValue":$=>d(N,{name:$})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":$=>$&&d(N,{visibility:$})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=N.description)==null?void 0:y.ko)??"","onUpdate:modelValue":$=>u(N,"ko",$)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(N),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":$=>$&&p(N,$)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:N.sourceCode?"본문 ●":"본문",onClick:$=>m(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",A_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",T_,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,I_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),B_={class:"em-detail__tabs"},D_=["onClick"],O_=Le(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",B_,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,D_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(md,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(K1,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(N_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(M_,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Ai(e,t,o){e.openModal({component:O_,bind:{controller:n.markRaw(t),entityId:o}})}function L_(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Te(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Te();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Te()}for(const a of t.indexes??[]){a.modelId=Te();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const hn=Symbol("editorController");function gd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ti(e,t){const o=[];for(const i of t.remove)o.push(Pt(e,i));for(const i of t.update)o.push(tn(e,i.attributeId,i.patch));for(const i of t.add)o.push(It(e,i));return o}function On(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Ln(e,t){const o=[];for(const[i,a]of Uf(e,t,Te))o.push(...Ti(i,a));return o}function bd(e,t,o){const i=new Set(o.remove);return On(e,t,a=>[...a.filter(l=>!i.has(l.modelId)).map(l=>{const r=o.update.find(s=>s.attributeId===l.modelId);return r?{...l,...r.patch}:l}),...o.add])}function yl(e,t){const o=Jn(e,t,Te),i=Ti(t,o),a=bd(e,t,o);return i.push(...Ln(a,t)),i}function _d(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Te()}))}function P_(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,h)=>Math.max(m,h.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;a={modelId:Te(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Te(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(It(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const p=e.associations.find(g=>g.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,h=m?p.end1:p.end2,b=m?p.end2:p.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:h.multiplicity,navigable:h.navigable,composition:!1},end2:{entityRef:t,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(p=>p.ownerId===u.modelId).map(p=>p.dispId));return f.size?{...u,attributes:u.attributes.filter(p=>!f.has(p.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(p=>p.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=Jn(r,t,Te);for(const u of l){const f=s.add.find(p=>{var m;return((m=p.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(Pt(u.ownerId,u.dispId)),i.push(Yo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Ti(t,s));const c=bd(r,t,s);return i.push(...Ln(c,t)),i}function z_(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(y=>y.modelId===c);if(!d||d.attributes.some(y=>{var $;return(($=y.embedded)==null?void 0:$.associationRef)===l.modelId}))continue;const u=Te(),f=d.attributes.reduce((y,$)=>Math.max(y,$.order),-1)+1,p=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let h=m;for(let y=2;p.has(h);y++)h=`${m}${y}`;const b=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Te()})),g={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:b,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(It(c,g));const _=r?"end2":"end1",N=r?"end1":"end2";i.push(Yo(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Te()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function U_(e=gd(),t={}){var ve,Ee;const o=n.reactive(e);let i=new ga(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),h=n.ref(!1),b=n.ref(!1),g=n.ref(0),_=n.ref(((ve=t.meta)==null?void 0:ve.schemaVersion)??1),N=n.ref(((Ee=t.meta)==null?void 0:Ee.opWriteEnabled)??!1),y=n.computed(()=>_.value>=2&&N.value),$=t.historyTransport,K=n.computed(()=>y.value&&$!==void 0),F=t.restoreTransport,q=n.ref(0),G=n.computed(()=>y.value&&Q.value&&F!==void 0);async function X(w){if(!F||!Q.value)return{ok:!1,reason:"unavailable"};const x=await F(w);return x.ok&&q.value++,x}const Q=n.ref(!(_.value>=2&&N.value===!1)),de=n.ref("LOGICAL_PHYSICAL"),B=n.ref("straight"),ee=n.ref(!0),v=n.ref(!0),R=n.ref(null),E=n.computed(()=>{var w;return((w=R.value)==null?void 0:w.kind)==="attribute"?{entityId:R.value.entityId,attrId:R.value.anchor}:null}),P=n.computed(()=>{var w;return((w=R.value)==null?void 0:w.kind)==="attribute"?R.value.ids:[]}),W=n.computed(()=>{var w,x;return((w=R.value)==null?void 0:w.kind)==="entity"?R.value.id:((x=R.value)==null?void 0:x.kind)==="attribute"?R.value.entityId:null}),oe=n.ref(null);let T=0;const J=n.ref(null),se=n.ref(null);let he=t.meta;function we(){i.onChange(()=>{m.value=i.canUndo,h.value=i.canRedo,b.value=i.isDirty,g.value++})}we();let re=null,me=null;function be(){me==null||me(),me=null,re=null}function xe(){if(be(),!y.value||!t.opTransport)return;const w=new Kr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:x=>{Q.value=!1,se.value=x},onError:t.onOpError});w.seed((he==null?void 0:he.revSeed)??{}),me=w.attach(i),re=w}xe();const Ce=n.computed(()=>Hl(o.logical,o.layout)),Se=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:a.value})),ye=n.computed(()=>or(o.logical,Se.value)),Y=n.computed(()=>{const w=new Map;for(const x of ye.value){if(!x.targetRef)continue;const j=w.get(x.targetRef);j?j.push(x):w.set(x.targetRef,[x])}return w}),C=w=>{Q.value&&i.execute(w)},k=w=>o.layout.entityLayouts.some(x=>x.entityRef===w&&!!x.locked),V=w=>o.layout.groupLayouts.some(x=>x.groupRef===w&&!!x.locked),H=w=>{const x=o.logical.associations.find(j=>j.modelId===w);return!!x&&(k(x.end1.entityRef)||k(x.end2.entityRef))},te=(w,x,j)=>{if(k(w))return;const le=tn(w,x,j),_e=On(o.logical,w,U=>U.map(M=>M.modelId===x?{...M,...j}:M)),O=Ln(_e,w);C(O.length?ze("속성 수정",[le,...O]):le)};function ne(w){const x=w.map(pe=>o.layout.entityLayouts.find(S=>S.entityRef===pe)).filter(pe=>!!pe);if(!x.length)return{location:{x:40,y:40},size:{width:400,height:300}};let j=1/0,le=1/0,_e=-1/0,O=-1/0;for(const pe of x){const S=pe.geo.size.width||220,D=pe.geo.size.height||140;j=Math.min(j,pe.geo.location.x),le=Math.min(le,pe.geo.location.y),_e=Math.max(_e,pe.geo.location.x+S),O=Math.max(O,pe.geo.location.y+D)}const U=40,M=28;return{location:{x:j-U,y:le-U-M},size:{width:_e-j+U*2,height:O-le+U*2+M}}}function ge(w,x,j){var pe;const le=o.layout.groupLayouts.find(S=>S.groupRef===w),_e=(le==null?void 0:le.geo.location)??x,O=x.x-_e.x,U=x.y-_e.y,M=[gr(w,x),...j.map(S=>Nn(S.id,S.location))];if(O||U){const S=new Set(((pe=o.logical.groups.find(D=>D.modelId===w))==null?void 0:pe.memberEntityRefs)??[]);for(const D of o.logical.associations){if(!S.has(D.end1.entityRef)||!S.has(D.end2.entityRef))continue;const I=o.layout.associationLayouts.find(L=>L.associationRef===D.modelId);I&&I.waypoints.length&&M.push(Vr(D.modelId,O,U))}for(const D of(le==null?void 0:le.memberNoteRefs)??[]){const I=o.layout.notes.find(L=>L.modelId===D);I&&M.push(Zn(D,{x:I.geo.location.x+O,y:I.geo.location.y+U}))}}return M}return{state:o,resolved:Ce,issues:ye,issuesByRef:Y,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:h,dirty:b,revision:g,editable:Q,schemaVersion:_,opWriteEnabled:N,opMode:y,opConflict:se,historyTransport:$,historyAvailable:K,restoreTransport:F,restoreAvailable:G,restoreToSeq:X,reloadRequest:q,displayMode:de,routingMode:B,showGrid:ee,showMinimap:v,selection:R,selectedAttr:E,selectedAttrIds:P,inspectedEntityId:W,focusRequest:oe,clipboard:J,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(w){Q.value=w&&y.value},setEmbeddableCatalog(w){a.value=w},setGroupCodeCatalog(w){l.value=w},setPredefinedCustomTypeCatalog(w){r.value=w},selectAttribute(w,x,j="replace"){const le=R.value,_e=(le==null?void 0:le.kind)==="attribute"&&le.entityId===w;if(j==="replace"||!_e){R.value={kind:"attribute",entityId:w,ids:[x],anchor:x};return}if(j==="toggle"){const I=le.ids.includes(x),L=I?le.ids.filter(ue=>ue!==x):[...le.ids,x];if(!L.length){R.value=null;return}const ie=I&&le.anchor===x?L[L.length-1]:I?le.anchor:x;R.value={kind:"attribute",entityId:w,ids:L,anchor:ie};return}const O=o.logical.entities.find(I=>I.modelId===w),U=[...(O==null?void 0:O.attributes)??[]].sort((I,L)=>I.order-L.order).map(I=>I.modelId),M=U.indexOf(le.anchor),pe=U.indexOf(x);if(M<0||pe<0){R.value={kind:"attribute",entityId:w,ids:[x],anchor:x};return}const[S,D]=M<=pe?[M,pe]:[pe,M];R.value={kind:"attribute",entityId:w,ids:U.slice(S,D+1),anchor:le.anchor}},moveAttributeFocus(w){const x=R.value;if((x==null?void 0:x.kind)!=="attribute")return!1;const j=o.logical.entities.find(U=>U.modelId===x.entityId);if(!j||!j.attributes.length)return!1;const le=j.attributes.findIndex(U=>U.modelId===x.anchor);if(le<0)return!1;const _e=Math.min(Math.max(le+w,0),j.attributes.length-1);if(_e===le)return!0;const O=j.attributes[_e].modelId;return R.value={kind:"attribute",entityId:x.entityId,ids:[O],anchor:O},!0},nudgeSelectedAttributes(w){const x=R.value;if((x==null?void 0:x.kind)!=="attribute")return!1;const j=o.logical.entities.find(I=>I.modelId===x.entityId);if(!j)return!1;const le=j.attributes,_e=new Set(x.ids),O=le.map((I,L)=>_e.has(I.modelId)?L:-1).filter(I=>I>=0);if(!O.length)return!1;const U=Math.min(...O),M=le.filter(I=>!_e.has(I.modelId)),pe=le.slice(0,U).filter(I=>!_e.has(I.modelId)).length;let S;if(w<0){if(pe<=0)return!0;S=pe-1}else{if(M.length-pe<=0)return!0;S=pe+1}if(k(x.entityId))return!0;const D=le.filter(I=>_e.has(I.modelId)).map(I=>I.modelId);return C(Ea(x.entityId,D,S)),!0},deleteSelection(){if(!Q.value)return!1;const w=R.value;if(!w)return!1;if(w.kind==="attribute"){if(k(w.entityId))return!1;const x=w.ids;if(!x.length)return!1;x.length===1?C(Pt(w.entityId,x[0])):C(ze("속성 삭제",x.map(j=>Pt(w.entityId,j))))}else if(w.kind==="entity"){if(k(w.id))return!1;C(_a(w.id))}else if(w.kind==="note")C(xa(w.id));else if(w.kind==="group"){if(V(w.id))return!1;C(ka(w.id))}else C($a(w.id));return R.value=null,!0},nudgeNodes(w,x,j){if(!w.length||x===0&&j===0)return!1;const le=new Set(o.logical.entities.map(S=>S.modelId)),_e=new Set(o.logical.groups.map(S=>S.modelId)),O=new Set(o.layout.notes.map(S=>S.modelId)),U=new Set;for(const S of w){if(!_e.has(S))continue;const D=o.logical.groups.find(I=>I.modelId===S);for(const I of(D==null?void 0:D.memberEntityRefs)??[])U.add(I)}const M=[],pe=[];for(const S of w)if(_e.has(S)){if(V(S))continue;const D=o.layout.groupLayouts.find(ue=>ue.groupRef===S);if(!D)continue;const I=o.logical.groups.find(ue=>ue.modelId===S),L=((I==null?void 0:I.memberEntityRefs)??[]).map(ue=>{var A;const fe=((A=o.layout.entityLayouts.find(Z=>Z.entityRef===ue))==null?void 0:A.geo.location)??{x:0,y:0};return{id:ue,location:{x:fe.x+x,y:fe.y+j}}}),ie={x:D.geo.location.x+x,y:D.geo.location.y+j};M.push(ze("그룹 이동",ge(S,ie,L))),pe.push("g:"+S)}else if(le.has(S)){if(U.has(S)||k(S))continue;const D=o.layout.entityLayouts.find(I=>I.entityRef===S);if(!D)continue;M.push(Nn(S,{x:D.geo.location.x+x,y:D.geo.location.y+j})),pe.push("e:"+S)}else if(O.has(S)){const D=o.layout.notes.find(I=>I.modelId===S);if(!D)continue;M.push(Zn(S,{x:D.geo.location.x+x,y:D.geo.location.y+j})),pe.push("n:"+S)}return M.length?(C(ze("이동",M,"nudge:"+pe.sort().join(","))),!0):!1},requestFocus(w){oe.value={id:w,nonce:++T}},undo:()=>{Q.value&&i.undo()},redo:()=>{Q.value&&i.redo()},markSaved:()=>{Q.value&&(re==null||re.flush(),i.markSavePoint())},loadDiagram(w,x){be(),o.logical=w.logical,o.layout=w.layout,i=new ga(o),we(),_.value=(x==null?void 0:x.schemaVersion)??1,N.value=(x==null?void 0:x.opWriteEnabled)??!1,Q.value=!(_.value>=2&&N.value===!1),he=x,se.value=null,R.value=null,m.value=i.canUndo,h.value=i.canRedo,b.value=i.isDirty,xe()},flush(){re==null||re.flush()},whenOpsSettled(){return(re==null?void 0:re.whenSettled())??Promise.resolve()},addEntity(w="NewEntity",x={x:80,y:80}){const j=Te(),le={modelId:j,name:w,stereotype:"JPA_ENTITY",table:{physicalName:w.toLowerCase()},attributes:[{modelId:Te(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Te(),physicalName:"id",dataType:"BIGINT"}]}]};return C(ba(le,{location:{...x},size:{width:220,height:140}})),j},renameEntity(w,x){k(w)||C(dr(w,x))},updateEntity(w,x){if(k(w))return;const j=cr(w,x),le=o.logical.entities.find(U=>U.modelId===w),_e=x.stereotype==="JPA_EMBEDDABLE"&&!!le&&le.stereotype!=="JPA_EMBEDDABLE",O=!!x.stereotype&&x.stereotype!=="JPA_EMBEDDABLE"&&!!le&&le.stereotype==="JPA_EMBEDDABLE";if(_e&&le){const U=le.attributes.filter(I=>I.identifier&&!I.derivedFrom).map(I=>tn(w,I.modelId,{identifier:!1})),M=On({...o.logical,entities:o.logical.entities.map(I=>I.modelId===w?{...I,stereotype:"JPA_EMBEDDABLE"}:I)},w,I=>I.map(L=>L.identifier&&!L.derivedFrom?{...L,identifier:!1}:L)),pe=yl(M,w),S=z_(o.logical,w),D=[j,...U,...pe,...S];C(D.length>1?ze("임베더블 변환",D):j);return}if(O){const U=P_(o.logical,w),M=[j,...U];C(M.length>1?ze("엔터티 전환",M):j);return}C(j)},moveEntity(w,x){k(w)||C(Nn(w,x))},resizeEntity(w,x){k(w)||C(ur(w,x))},removeEntity(w){k(w)||C(_a(w))},setEntitySwatch(w,x){C(fr(w,x))},setEntityCollapsed(w,x){C(mr(w,x))},setEntityLocked(w,x){C(pr(w,x))},isEntityLocked(w){return k(w)},collapseAll(){C(wa(!0))},expandAll(){C(wa(!1))},setAttributeSwatch(w,x,j){C(Fo(w,x,j))},dragGroup(w,x,j){V(w)||C(ze("그룹 이동",ge(w,x,j)))},resizeGroup(w,x){V(w)||C(br(w,x))},setGroupSwatch(w,x){C(_r(w,x))},setGroupLocked(w,x){C(wr(w,x))},isGroupLocked(w){return V(w)},updateGroup(w,x){V(w)||C(hr(w,x))},createGroup(w,x){if(!w.length)return null;const j=[];for(const O of o.logical.groups)for(const U of w)O.memberEntityRefs.includes(U)&&j.push(Go(O.modelId,U));const le=Te(),_e={modelId:le,name:x?{ko:x}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...w]};return j.push(va(_e,ne(w))),C(ze("그룹 생성",j)),R.value=null,le},addEmptyGroup(w,x){const j=Te();return C(va({modelId:j,name:x?{ko:x}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),j},removeGroup(w){V(w)||C(ka(w))},dropEntity(w,x,j){var O;if(k(w))return;const le=((O=o.logical.groups.find(U=>U.memberEntityRefs.includes(w)))==null?void 0:O.modelId)??null,_e=[Nn(w,x)];le!==j&&(le&&_e.push(Go(le,w)),j&&_e.push(yr(j,w))),C(ze("이동",_e))},ungroupEntity(w){const x=o.logical.groups.find(j=>j.memberEntityRefs.includes(w));x&&C(Go(x.modelId,w))},dropNote(w,x,j){var O;const le=((O=o.layout.groupLayouts.find(U=>{var M;return(M=U.memberNoteRefs)==null?void 0:M.includes(w)}))==null?void 0:O.groupRef)??null,_e=[Zn(w,x)];le!==j&&(le&&_e.push(Pr(le,w)),j&&_e.push(Lr(j,w))),C(ze("이동",_e))},addPredefinedEmbed(w,x){if(k(w))return;const j=a.value.find(pe=>pe.type===x),le=o.logical.entities.find(pe=>pe.modelId===w);if(!j||!le)return;const _e=le.attributes.reduce((pe,S)=>Math.max(pe,S.order),-1)+1,O=Te(),U=j.fields.map(()=>({modelId:Te(),physicalName:"",dataType:""})),M={modelId:O,name:j.defaultName,type:j.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:_e,dbAttrs:U};return C(It(w,M)),O},addAttribute(w,x={}){if(k(w))return x.modelId??"";const j=o.logical.entities.find(D=>D.modelId===w),le=j?j.attributes.length:0,_e=x.modelId??Te(),O=x.name??`field${le}`,U={modelId:_e,name:O,type:x.type??da,attrType:x.attrType??"NORMAL",identifier:x.identifier??!1,notNull:x.notNull??!1,order:le,dbAttrs:x.dbAttrs??[{modelId:Te(),physicalName:O,dataType:"VARCHAR",length:255}],...x},M=It(w,U),pe=On(o.logical,w,D=>[...D,U]),S=Ln(pe,w);return C(S.length?ze("속성 추가",[M,...S]):M),_e},addDivider(w){if(k(w))return"";const x=o.logical.entities.find(O=>O.modelId===w),j=x?x.attributes.length:0,le=Te();return C(It(w,{modelId:le,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:j,dbAttrs:[]})),le},updateAttribute(w,x,j){te(w,x,j)},setAttributeGroupCode(w,x,j){te(w,x,{groupCode:j,type:j?Yn:da})},setEmbedColumns(w,x,j){var pe,S;if(k(w))return;const le=tn(w,x,{dbAttrs:j}),_e=(pe=o.logical.entities.find(D=>D.modelId===w))==null?void 0:pe.attributes.find(D=>D.modelId===x),O=(S=_e==null?void 0:_e.embedded)==null?void 0:S.associationRef,U=O?o.logical.associations.find(D=>D.modelId===O):void 0,M=[];U&&O&&(U.end1.legacyEmbedRaw&&M.push($n(O,"end1",{legacyEmbedRaw:void 0})),U.end2.legacyEmbedRaw&&M.push($n(O,"end2",{legacyEmbedRaw:void 0}))),C(M.length?ze("임베드 컬럼 수정",[le,...M]):le)},removeAttribute(w,x){if(k(w))return;const j=Pt(w,x),le=On(o.logical,w,O=>O.filter(U=>U.modelId!==x)),_e=Ln(le,w);C(_e.length?ze("속성 삭제",[j,..._e]):j)},removeAttributes(w,x){var U;if(!x.length||k(w))return;const j=x.map(M=>Pt(w,M)),le=new Set(x),_e=On(o.logical,w,M=>M.filter(pe=>!le.has(pe.modelId))),O=[...j,...Ln(_e,w)];C(O.length===1?O[0]:ze("속성 삭제",O)),((U=R.value)==null?void 0:U.kind)==="attribute"&&R.value.entityId===w&&(R.value=null)},setAttributeSwatches(w,x,j){x.length&&(x.length===1?C(Fo(w,x[0],j)):C(ze("속성 색상",x.map(le=>Fo(w,le,j)))))},reorderAttributes(w,x,j){!x.length||k(w)||C(Ea(w,x,j))},addIndex(w,x){k(w)||C(xr(w,x))},updateIndex(w,x,j){k(w)||C(Ir(w,x,j))},removeIndex(w,x){k(w)||C(Sr(w,x))},addOperation(w,x={}){var U;if(k(w))return x.modelId??"";const j=o.logical.entities.find(M=>M.modelId===w),le=((U=j==null?void 0:j.operations)==null?void 0:U.length)??0,_e=x.modelId??Te(),O={modelId:_e,name:x.name??`method${le}`,visibility:x.visibility??"PACKAGE",order:le,...x};return C(vr(w,O)),_e},updateOperation(w,x,j){k(w)||C(kr(w,x,j))},removeOperation(w,x){k(w)||C(Er(w,x))},reorderOperations(w,x,j){!x.length||k(w)||C(Nr(w,x,j))},setOperationSwatch(w,x,j){C($r(w,x,j))},addAssociation(w,x,j,le){if(k(w)||k(x))return"";const _e=Te(),O={modelId:_e,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:j},end2:{entityRef:x,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},U={...o.logical,associations:[...o.logical.associations,O]},M=Jn(U,x,Te),pe=M.add[0];pe&&(O.end2.attributeRef=pe.modelId);const S={associationRef:_e,waypoints:[],sourceColumnRef:j,targetColumnRef:(pe==null?void 0:pe.modelId)??le},D=Na(O,S),I=Ti(x,M);return C(I.length?ze("관계 추가",[D,...I]):D),_e},addEmbedAssociation(w,x){if(k(w))return;const j=o.logical.entities.find(A=>A.modelId===w),le=o.logical.entities.find(A=>A.modelId===x);if(!j||!le||le.stereotype!=="JPA_EMBEDDABLE")return;const _e=Te(),O=Te(),U=Te(),M=j.attributes.reduce((A,Z)=>Math.max(A,Z.order),-1)+1,pe=_d(le),S=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),D=new Set(j.attributes.map(A=>A.name)),I=S(le.name);let L=I;for(let A=2;D.has(L);A++)L=`${I}${A}`;const ie={modelId:O,name:L,type:le.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:M,dbAttrs:pe,embedded:{associationRef:_e,embeddableRef:x}},ue={modelId:_e,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:U},end2:{entityRef:x,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:O}},fe={associationRef:_e,waypoints:[],sourceColumnRef:O,targetColumnRef:void 0};return C(ze("임베드 추가",[It(w,ie),Na(ue,fe)])),_e},setEmbedCollectionMode(w,x){if(H(w))return;const j=o.logical.associations.find(S=>S.modelId===w);if(!j)return;let le,_e;for(const S of o.logical.entities){const D=S.attributes.find(I=>{var L;return((L=I.embedded)==null?void 0:L.associationRef)===w&&I.attrType==="EMBED_OWN"});if(D){le=S.modelId,_e=D;break}}if(!le||!_e)return;const O=_e.embedded.embeddableRef,U=j.end2.entityRef===O?"end2":"end1",M=j[U],pe=M.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(x==="COLLECTION"?pe:!pe))if(x==="COLLECTION")C(ze("임베드 컬렉션 전환",[tn(le,_e.modelId,{dbAttrs:[]}),$n(w,U,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...M.jpa,collectionType:"LIST"}})]));else{const S=o.logical.entities.find(D=>D.modelId===O);if(!S)return;C(ze("임베드 단일 전환",[tn(le,_e.modelId,{dbAttrs:_d(S)}),$n(w,U,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...M.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(w){if(H(w))return;const x=o.logical.associations.find(U=>U.modelId===w),j=$a(w);if(!x){C(j);return}for(const U of o.logical.entities){const M=U.attributes.find(pe=>{var S;return((S=pe.embedded)==null?void 0:S.associationRef)===w});if(M){C(ze("임베드 삭제",[j,Pt(U.modelId,M.modelId)]));return}}const le=x.end2.entityRef,_e={...o.logical,associations:o.logical.associations.filter(U=>U.modelId!==w)},O=yl(_e,le);C(O.length?ze("관계 삭제",[j,...O]):j)},setAssociationIdentifying(w,x){if(H(w))return;const j=o.logical.associations.find(M=>M.modelId===w),le=Yo(w,{identifying:x});if(!j||j.identifying===x){C(le);return}const _e=j.end2.entityRef,O={...o.logical,associations:o.logical.associations.map(M=>M.modelId===w?{...M,identifying:x}:M)},U=yl(O,_e);C(U.length?ze("식별 관계 변경",[le,...U]):le)},updateAssociationEnd(w,x,j){H(w)||C($n(w,x,j))},moveWaypoint(w,x,j){C(Cr(w,x,j))},addWaypoint(w,x,j){C(Tr(w,x,j))},removeWaypoint(w,x){C(Rr(w,x))},clearWaypoints(w){C(Ar(w))},addNote(w="메모",x={x:80,y:80}){const j=Te();return C(Mr({modelId:j,memo:w,geo:{location:{...x},size:{width:200,height:120}}})),j},removeNote(w){C(xa(w))},moveNote(w,x){C(Zn(w,x))},resizeNote(w,x){C(Br(w,x))},setNoteMemo(w,x){C(Dr(w,x))},setNoteSwatch(w,x){C(Or(w,x))},addNoteConnection(w,x){C(zr(w,x))},removeNoteConnection(w,x){C(Ur(w,x))},moveNoteConnectionWaypoint(w,x,j,le){C(Hr(w,x,j,le))},addNoteConnectionWaypoint(w,x,j,le){C(Fr(w,x,j,le))},removeNoteConnectionWaypoint(w,x,j){C(Gr(w,x,j))},clearNoteConnectionWaypoints(w,x){C(Yr(w,x))},autoLayout(){const w=Yl(o.logical,o.layout);w.length&&C(ze("자동 배치",w.map(x=>Nn(x.id,x.location))))},copy(){const w=R.value;if((w==null?void 0:w.kind)==="attribute"){const O=o.logical.entities.find(M=>M.modelId===w.entityId);if(!O)return;const U=[...O.attributes].sort((M,pe)=>M.order-pe.order).filter(M=>w.ids.includes(M.modelId));if(!U.length)return;J.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:U}));return}const x=W.value;if(!x)return;const j=o.logical.entities.find(O=>O.modelId===x),le=o.layout.entityLayouts.find(O=>O.entityRef===x);if(!j)return;const _e=(le==null?void 0:le.geo)??{location:{x:80,y:80},size:{width:220,height:140}};J.value=JSON.parse(JSON.stringify({kind:"entity",entity:j,geo:_e}))},paste(){if(!Q.value)return;const w=J.value;if(!w)return;if(w.kind==="attribute"){const le=W.value;if(!le)return;const _e=o.logical.entities.find(D=>D.modelId===le);if(!_e)return;const O=new Set(_e.attributes.map(D=>D.name)),U=new Set(_e.attributes.flatMap(D=>D.dbAttrs.map(I=>I.physicalName))),M=_e.attributes.length,pe=[],S=w.attributes.map((D,I)=>{const L=JSON.parse(JSON.stringify(D));L.modelId=Te();for(const ie of L.dbAttrs)ie.modelId=Te();O.has(L.name)&&(L.name=`${L.name}_copy`);for(const ie of L.dbAttrs)ie.physicalName&&U.has(ie.physicalName)&&(ie.physicalName=`${ie.physicalName}_copy`);return L.order=M+I,pe.push(L.modelId),It(le,L)});C(S.length===1?S[0]:ze("속성 붙여넣기",S)),R.value={kind:"attribute",entityId:le,ids:pe,anchor:pe[pe.length-1]};return}const x=L_(w.entity),j={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};C(ba(x,j)),R.value={kind:"entity",id:x.modelId}}}}const Mi=Symbol("groupHover"),wd=Symbol("groupDrag"),Pn=Symbol("relationHighlight"),H_={key:0,class:"em-sel","aria-hidden":"true"},F_=["title","aria-expanded","disabled"],G_={class:"em-entity__stereotype"},Y_={key:1,class:"em-entity__name"},W_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],K_=["onPointerdown"],q_={key:1,class:"em-entity__divider-label"},X_=["title"],j_={class:"em-key-slot"},Z_={class:"em-key-slot"},J_={key:0,class:"em-entity__type"},Q_=["onClick"],ew={class:"em-entity__attrname"},tw={class:"em-entity__type"},nw=["data-op"],ow=["onPointerdown"],iw={class:"em-entity__op-vis","aria-hidden":"true"},aw=["title"],lw={key:4,class:"em-entity__footer"},vd=Le(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(hn,null),i=ae.useModal();function a(){o&&Ai(i,o,t.id)}const l=n.inject(Mi,null),r=n.inject(Pn,null),s=n.computed(()=>!!o&&o.editable.value);function c(){l&&(l.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),p=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var I;return((I=o==null?void 0:o.selection.value)==null?void 0:I.kind)==="entity"&&o.selection.value.id===t.id}),h=n.computed(()=>!!t.selected&&!m.value),b=n.computed(()=>{var I;return o&&((I=o.selectedAttr.value)==null?void 0:I.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),g=n.computed(()=>b.value.size>0);function _(I,L){const ie=L.shiftKey?"range":L.metaKey||L.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,I.modelId,ie)}const N=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),$=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),K=n.computed(()=>t.data.collapsed??!1),F=n.computed(()=>t.data.locked??!1);function q(){s.value&&(o==null||o.setEntityCollapsed(t.id,!K.value))}const G=n.computed(()=>$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL"),X=n.computed(()=>{const I=$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL",L={};for(const ie of y.value.attributes){const ue=ie.attrType.startsWith("RELATION")&&ie.dbAttrs.length>0;L[ie.modelId]={pk:ie.identifier,fk:ue&&I,required:ie.notNull&&!ie.identifier}}return L});function Q(I){if(!I)return"";const L=[];return I.pk&&I.fk?L.push("PFK (식별 외래키)"):I.pk?L.push("PK (기본키)"):I.fk&&L.push("FK (외래키)"),I.required&&L.push("필수 (NOT NULL)"),L.join(" · ")}const de=n.computed(()=>{const I=ml(Qe(t.data.style)),L={};return I&&(L["--em-header-bg"]=I.bar,L["--em-header-fg"]=I.barOn),L});function B(I){var L,ie;return(ie=ml(Qe((L=t.data.attributeStyles)==null?void 0:L[I.modelId])))==null?void 0:ie.text}const ee=n.computed(()=>[...y.value.operations??[]].sort((I,L)=>I.order-L.order)),v=n.computed(()=>$.value==="CLASS"&&ee.value.length>0),R={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function E(I){return I?R[I]:"~"}function P(I){var L,ie;return(ie=ml(Qe((L=t.data.operationStyles)==null?void 0:L[I.modelId])))==null?void 0:ie.text}function W(I,L,ie){switch($.value){case"CLASS":return[{text:I}];case"PHYSICAL":return[{text:ie||I}];case"LOGICAL":return[L?{text:L}:{text:"(논리명)",missing:!0}];default:{const ue=L?{text:L}:{text:"(논리명)",missing:!0};return ie?[ue,{text:` · ${ie}`}]:[ue]}}}function oe(I){var L,ie,ue;return T(I)?[{text:I.name}]:W(I.name,(ie=(L=I.dbAttrs[0])==null?void 0:L.logicalName)==null?void 0:ie.ko,((ue=I.dbAttrs[0])==null?void 0:ue.physicalName)??"")}function T(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function J(I){return I.attrType==="DIVIDER"}function se(I){if(I.attrType!=="EMBED_PREDEF")return I.dbAttrs;const L=o==null?void 0:o.embeddableCatalog.value.find(ue=>ue.type===I.type);if(!L)return I.dbAttrs;const ie=Wn(y.value.attributes.flatMap(ue=>ue.dbAttrs));return I.dbAttrs.map((ue,fe)=>{const A=L.fields[fe],Z=Po(ue,ie);return Z?{...ue,physicalName:Z.physicalName,logicalName:ue.logicalName??(A==null?void 0:A.logicalName),dataType:ue.dataType||(A==null?void 0:A.dataType)||""}:A?{...ue,physicalName:ue.physicalName||A.physicalName,logicalName:ue.logicalName??A.logicalName,dataType:ue.dataType||A.dataType,length:ue.length??A.length}:ue})}function he(I){var L;return W(I.physicalName,(L=I.logicalName)==null?void 0:L.ko,I.physicalName)}function we(I){const L=tr(I,(o==null?void 0:o.state.logical.associations)??[]);return fa($.value,I,L)}const re=n.computed(()=>{var I,L,ie;return W(y.value.name,(L=(I=y.value.table)==null?void 0:I.logicalName)==null?void 0:L.ko,((ie=y.value.table)==null?void 0:ie.physicalName)??"")}),me=n.ref(!1),be=n.ref(""),xe=n.ref(null);async function Ce(){var I,L;s.value&&(be.value=y.value.name,me.value=!0,await n.nextTick(),(I=xe.value)==null||I.focus(),(L=xe.value)==null||L.select())}function Se(){if(!me.value)return;me.value=!1;const I=be.value.trim();I&&I!==y.value.name&&(o==null||o.renameEntity(t.id,I))}function ye(){o==null||o.addAttribute(t.id)}function Y(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:C,findNode:k}=De(),V=n.ref(null),H=n.computed(()=>{const I=V.value??t.data.size;return I?{width:`${I.width}px`,minHeight:`${I.height}px`}:void 0});let te=null;function ne(I){var ue,fe,A;if(!s.value)return;I.stopPropagation();const L=(ue=k(t.id))==null?void 0:ue.dimensions,ie=C({x:I.clientX,y:I.clientY});te={fx:ie.x,fy:ie.y,w:(L==null?void 0:L.width)??((fe=t.data.size)==null?void 0:fe.width)??200,h:(L==null?void 0:L.height)??((A=t.data.size)==null?void 0:A.height)??120},I.target.setPointerCapture(I.pointerId)}function ge(I){if(!te)return;const L=C({x:I.clientX,y:I.clientY});V.value={width:Math.max(40,te.w+(L.x-te.fx)),height:Math.max(40,te.h+(L.y-te.fy))}}function ve(I){var L,ie,ue;if(te&&V.value&&o){const fe=(L=k(t.id))==null?void 0:L.dimensions;o.resizeEntity(t.id,{width:Math.round((fe==null?void 0:fe.width)??V.value.width),height:Math.round((fe==null?void 0:fe.height)??V.value.height)})}te=null,V.value=null,(ue=(ie=I.target).releasePointerCapture)==null||ue.call(ie,I.pointerId)}const Ee=n.ref(null),w=n.ref(null);function x(I,L){if(!s.value)return;L.stopPropagation(),L.preventDefault();const ie=b.value,ue=ie.has(I.modelId)?new Set(ie):new Set([I.modelId]);w.value={ids:ue,dropIndex:-1,lineY:0},L.target.setPointerCapture(L.pointerId)}function j(I){if(!w.value||!Ee.value)return;const L=Array.from(Ee.value.querySelectorAll(".em-entity__row"));if(!L.length)return;let ie=L.length;for(let A=0;A<L.length;A++){const Z=L[A].getBoundingClientRect();if(I.clientY<Z.top+Z.height/2){ie=A;break}}const ue=L[L.length-1],fe=ie<L.length?L[ie].offsetTop:ue.offsetTop+ue.offsetHeight;w.value={...w.value,dropIndex:ie,lineY:fe}}function le(){const I=w.value;if(w.value=null,!I||I.dropIndex<0)return;const L=y.value.attributes,ie=L.filter(z=>I.ids.has(z.modelId)).map(z=>z.modelId),ue=L.filter((z,ce)=>I.ids.has(z.modelId)&&ce<I.dropIndex).length,fe=I.dropIndex-ue,A=L.filter(z=>!I.ids.has(z.modelId)).map(z=>z.modelId);[...A.slice(0,fe),...ie,...A.slice(fe)].join(",")!==L.map(z=>z.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,ie,fe))}function _e(){w.value=null}const O=n.ref(null),U=n.ref(null);function M(I,L){s.value&&(L.stopPropagation(),L.preventDefault(),U.value={id:I.modelId,dropIndex:-1,lineY:0},L.target.setPointerCapture(L.pointerId))}function pe(I){if(!U.value||!O.value)return;const L=Array.from(O.value.querySelectorAll(".em-entity__op-row"));if(!L.length)return;let ie=L.length;for(let A=0;A<L.length;A++){const Z=L[A].getBoundingClientRect();if(I.clientY<Z.top+Z.height/2){ie=A;break}}const ue=L[L.length-1],fe=ie<L.length?L[ie].offsetTop:ue.offsetTop+ue.offsetHeight;U.value={...U.value,dropIndex:ie,lineY:fe}}function S(){const I=U.value;if(U.value=null,!I||I.dropIndex<0)return;const ie=ee.value.findIndex(fe=>fe.modelId===I.id);if(ie<0)return;const ue=I.dropIndex-(ie<I.dropIndex?1:0);ue!==ie&&(o==null||o.reorderOperations(t.id,[I.id],ue))}function D(){U.value=null}return(I,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":N.value,"is-selected":m.value,"is-multi-selected":h.value,"has-focused-attr":g.value,"is-locked":F.value}]),style:n.normalizeStyle(H.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",H_,[...L[7]||(L[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(de.value),onDblclick:n.withModifiers(Ce,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:K.value?"펼치기":"접기","aria-expanded":!K.value,disabled:!s.value,onClick:n.withModifiers(q,["stop"]),onPointerdown:L[0]||(L[0]=n.withModifiers(()=>{},["stop"])),onDblclick:L[1]||(L[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(K.value?"▸":"▾"),41,F_),n.createElementVNode("span",G_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),me.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:xe,"onUpdate:modelValue":L[2]||(L[2]=ie=>be.value=ie),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Se,["enter"]),L[3]||(L[3]=n.withKeys(ie=>me.value=!1,["esc"]))],onBlur:Se,onPointerdown:L[4]||(L[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,be.value]]):(n.openBlock(),n.createElementBlock("span",Y_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(re.value,(ie,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":ie.missing})},n.toDisplayString(ie.text),3))),128))])),F.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),K.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Ee,class:"em-entity__attrs"},[w.value&&w.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${w.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,ie=>{var ue,fe,A,Z;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ie.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(ie.modelId),"is-dragging":(ue=w.value)==null?void 0:ue.ids.has(ie.modelId),"is-embed":T(ie),"is-divider":J(ie),nodrag:J(ie)&&s.value}]),"data-attr":ie.modelId,onClick:n.withModifiers(z=>_(ie,z),["stop"]),onPointerdown:z=>J(ie)?x(ie,z):void 0,onPointermove:z=>J(ie)?j(z):void 0,onPointerup:z=>J(ie)?le():void 0,onPointercancel:z=>J(ie)?_e():void 0},[s.value&&!J(ie)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:z=>x(ie,z),onPointermove:j,onPointerup:le,onPointercancel:_e,onClick:L[5]||(L[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,K_)):n.createCommentVNode("",!0),J(ie)?(n.openBlock(),n.createElementBlock("span",q_,n.toDisplayString(ie.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(un),{id:`l:${ie.modelId}`,type:"target",position:n.unref(Ie).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:Q(X.value[ie.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",j_,[(fe=X.value[ie.modelId])!=null&&fe.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(A=X.value[ie.modelId])!=null&&A.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Z_,[T(ie)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Z=X.value[ie.modelId])!=null&&Z.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,X_),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:B(ie)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe(ie),(z,ce)=>(n.openBlock(),n.createElementBlock("span",{key:ce,class:n.normalizeClass({"em-entity__missing":z.missing})},n.toDisplayString(z.text),3))),128))],4),we(ie)?(n.openBlock(),n.createElementBlock("span",J_,n.toDisplayString(we(ie)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(un),{id:`r:${ie.modelId}`,type:"source",position:n.unref(Ie).Right,class:"em-handle"},null,8,["id","position"])],64))],42,W_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T(ie)&&G.value?se(ie):[],z=>(n.openBlock(),n.createElementBlock("li",{key:`${ie.modelId}:${z.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(ie.modelId)}]),onClick:n.withModifiers(ce=>_(ie,ce),["stop"])},[L[8]||(L[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",ew,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(he(z),(ce,Ae)=>(n.openBlock(),n.createElementBlock("span",{key:Ae,class:n.normalizeClass({"em-entity__missing":ce.missing})},n.toDisplayString(ce.text),3))),128))]),n.createElementVNode("span",tw,n.toDisplayString(z.dataType),1)],10,Q_))),128))],64)}),128))],512)),!K.value&&v.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:O,class:"em-entity__ops"},[U.value&&U.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${U.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ee.value,ie=>{var ue;return n.openBlock(),n.createElementBlock("li",{key:ie.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ue=U.value)==null?void 0:ue.id)===ie.modelId}]),"data-op":ie.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:fe=>M(ie,fe),onPointermove:pe,onPointerup:S,onPointercancel:D,onClick:L[6]||(L[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,ow)):n.createCommentVNode("",!0),n.createElementVNode("span",iw,n.toDisplayString(E(ie.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:P(ie)})},n.toDisplayString(ie.name)+"()",5)],10,nw)}),128))],512)):ee.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${ee.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(ee.value.length)+"개",1)],8,aw)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",lw,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ye},"+ 속성"),L[9]||(L[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:Y},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!me.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ne,onPointermove:ge,onPointerup:ve},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-7efbcdb3"]]),rw={key:0,class:"em-sel","aria-hidden":"true"},sw={class:"em-group__label"},cw={class:"em-group__name"},dw={key:0,class:"em-group__pkg"},uw={key:1,class:"em-group__flag"},kd=Le(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>Qe(t.data.style)),l=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),r=n.inject(hn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var X;return!!t.id&&((X=r==null?void 0:r.selection.value)==null?void 0:X.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Mi,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),p=n.inject(Pn,null);function m(){t.id&&(p==null||p.setGroupHover(t.id))}function h(){p==null||p.setGroupHover(null)}const b=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),g=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:N}=De();let y=null,$=null;function K(X){var B;if(!t.id||!s.value)return;X.stopPropagation();const Q=((B=N(t.id))==null?void 0:B.dimensions)??{width:400,height:300},de=_({x:X.clientX,y:X.clientY});y={fx:de.x,fy:de.y,w:Q.width,h:Q.height},X.target.setPointerCapture(X.pointerId)}function F(X){if(!y||!t.id)return;const Q=_({x:X.clientX,y:X.clientY});$={width:Math.max(160,y.w+(Q.x-y.fx)),height:Math.max(120,y.h+(Q.y-y.fy))};const de=N(t.id);de&&(de.style={width:`${$.width}px`,height:`${$.height}px`})}function q(X){var Q,de;y&&$&&t.id&&r&&r.resizeGroup(t.id,$),y=null,$=null,(de=(Q=X.target).releasePointerCapture)==null||de.call(Q,X.pointerId)}const G=n.computed(()=>{const X=o.value.name;return(X==null?void 0:X.ko)||(X==null?void 0:X.en)||(X==null?void 0:X.ja)||(X==null?void 0:X.zh)||o.value.packageName||"그룹"});return(X,Q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":b.value,"is-dimmed":g.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:h},[c.value?(n.openBlock(),n.createElementBlock("div",rw,[...Q[0]||(Q[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",sw,[n.createElementVNode("span",cw,n.toDisplayString(G.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",dw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",uw,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)]),s.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:K,onPointermove:F,onPointerup:q},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),fw={key:0,class:"em-sel","aria-hidden":"true"},mw={key:2,class:"em-note__text"},Ed=Le(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(hn,null),i=n.inject(Mi,null),a=n.inject(Pn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>Qe(l.value.style)),c=n.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function f(){a==null||a.setNoteHover(null)}const p=n.computed(()=>{var v;return((v=a==null?void 0:a.source.value)==null?void 0:v.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!p.value),h=n.computed(()=>{var v;return((v=o==null?void 0:o.selection.value)==null?void 0:v.kind)==="note"&&o.selection.value.id===t.id}),b=n.computed(()=>!!t.selected&&!h.value),g=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!h.value),_=[{id:"n-top",pos:Ie.Top},{id:"n-right",pos:Ie.Right},{id:"n-bottom",pos:Ie.Bottom},{id:"n-left",pos:Ie.Left}],N=n.ref(!1),y=n.ref(""),$=n.ref(null);async function K(){var v;r.value&&(y.value=l.value.memo,N.value=!0,await n.nextTick(),(v=$.value)==null||v.focus())}function F(){N.value&&(N.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:q,findNode:G}=De();let X=null,Q=null;function de(v){var P;if(!r.value)return;v.stopPropagation();const R=((P=G(t.id))==null?void 0:P.dimensions)??l.value.geo.size,E=q({x:v.clientX,y:v.clientY});X={fx:E.x,fy:E.y,w:R.width,h:R.height},v.target.setPointerCapture(v.pointerId)}function B(v){if(!X)return;const R=q({x:v.clientX,y:v.clientY});Q={width:Math.max(140,X.w+(R.x-X.fx)),height:Math.max(60,X.h+(R.y-X.fy))};const E=G(t.id);E&&(E.style={width:`${Q.width}px`,height:`${Q.height}px`})}function ee(v){var R,E;X&&Q&&o&&o.resizeNote(t.id,Q),X=null,Q=null,(E=(R=v.target).releasePointerCapture)==null||E.call(R,v.pointerId)}return(v,R)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":m.value,"is-dimmed":g.value,"is-selected":h.value,"is-multi-selected":b.value}]),style:n.normalizeStyle(c.value),onDblclick:K,onPointerdown:d,onMouseenter:u,onMouseleave:f},[h.value?(n.openBlock(),n.createElementBlock("div",fw,[...R[4]||(R[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:$,"onUpdate:modelValue":R[0]||(R[0]=E=>y.value=E),class:"em-note__edit nodrag",onBlur:F,onKeydown:R[1]||(R[1]=n.withKeys(E=>N.value=!1,["esc"])),onPointerdown:R[2]||(R[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",mw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,E=>n.createVNode(n.unref(un),{id:E.id,key:E.id,type:"source",position:E.pos,class:"em-note-handle",onPointerdown:R[3]||(R[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:de,onPointermove:B,onPointerup:ee},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),pw=20,hw=22,yw=7,gw=22,Nd=31,$d=7,bw=20,xd=11,Id=11,_w=Nd+$d;function ww(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function vw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Bi(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Math.hypot(i,a)||1;return{x:e.x+i*o/l,y:e.y+a*o/l}}function Sd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Di(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Cd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Sd(e,t);return[Di(o,a,l-Math.PI/2),Di(o,a,l+Math.PI/2)]}function Rd(e,t,o,i){const a=t*180/Math.PI,r=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function Vd(e,t,o,i){const a=[],l=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:l,polygons:r};if(i==="db"){const c=Bi(e,t,pw),[d,u]=Cd(e,t,c,hw);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}),ww(o.multiplicity)){const f=Bi(e,t,Nd);l.push({cx:f.x,cy:f.y,r:$d})}if(vw(o.multiplicity)){const f=Bi(e,t,yw),[p,m]=Cd(e,t,f,gw);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Bi(e,t,bw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Sd(e,t),f=Di(d,xd/2,u-Math.PI/2),p=Di(d,xd/2,u+Math.PI/2);r.push({points:[e,f,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=Rd(s,c,Id,!0),u=Rd(s,c,Id,!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:l,polygons:r}}const Ad=200,Td=120,gl=24;function Md(e){var a,l;if(!e)return{x:0,y:0,width:Ad,height:Td};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Ad,i=((l=e.dimensions)==null?void 0:l.height)||Td;return{x:t.x,y:t.y,width:o,height:i}}function Bd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Dd(e){const t=n.computed(()=>Md(e.sourceNode())),o=n.computed(()=>Md(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,h;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.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-f)<gl){const b=(f+p)/2;f=b-gl/2,p=b+gl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),l=n.computed(()=>e.waypoints()[0]??Bd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Bd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?la(t.value,d,l.value.x):aa(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?la(o.value,d,r.value.x):aa(o.value,r.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const bl=Symbol("waypointController"),kw=["d"],Ew=["d"],Nw=["d"],$w=["x1","y1","x2","y2"],xw=["cx","cy","r"],Iw=["x","y"],Sw=["x","y"],Cw=["cx","cy","onDblclick"],Rw=["x","y","onPointerdown","onDblclick"],Od=Le(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=De(),i=n.inject(bl),a=n.inject(hn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(wd,null),s=n.inject(Pn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var ye;return((ye=a==null?void 0:a.selection.value)==null?void 0:ye.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const ye=r==null?void 0:r.value;if(!ye||!a)return null;const Y=a.resolved.value.entities,C=V=>{var H;return(H=Y.find(te=>te.entity.modelId===V))==null?void 0:H.groupRef},k=t.data.association;return C(k.end1.entityRef)===ye.groupId&&C(k.end2.entityRef)===ye.groupId?{dx:ye.dx,dy:ye.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),h=n.ref({x:0,y:0}),b=n.computed(()=>{const ye=f.value;return p.value.map((Y,C)=>C===m.value?h.value:ye?{x:Y.x+ye.dx,y:Y.y+ye.dy}:Y)}),g=n.computed(()=>{var ye;return!!((ye=t.sourceNode.data)!=null&&ye.collapsed)}),_=n.computed(()=>{var ye;return!!((ye=t.targetNode.data)!=null&&ye.collapsed)}),{source:N,target:y,sourceSide:$,targetSide:K,isSelf:F}=Dd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>b.value,sourceRowY:()=>t.data.sourceColumnRef&&!g.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),q=_w+4,G=n.computed(()=>F.value?Gl(N.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?na(N.value,$.value,b.value,y.value,K.value,q):ia(N.value,b.value,y.value)),X=n.computed(()=>F.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?oa(N.value,$.value,b.value,y.value,K.value,q):ra(N.value,b.value,y.value).map((ye,Y)=>({point:ye,segIndex:Y}))),Q=n.computed(()=>F.value||!l.value?[]:b.value);function de(ye){switch(ye){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 B(ye,Y){m.value=ye,h.value={...p.value[ye]},Y.target.setPointerCapture(Y.pointerId),Y.stopPropagation()}function ee(ye){if(m.value<0)return;const Y=o({x:ye.clientX,y:ye.clientY});h.value={x:Y.x,y:Y.y}}function v(ye){var Y,C;m.value>=0&&i&&i.movePoint(t.id,m.value,{...h.value}),m.value=-1,(C=(Y=ye.target).releasePointerCapture)==null||C.call(Y,ye.pointerId)}function R(ye,Y){Y.stopPropagation(),i==null||i.removePoint(t.id,ye)}function E(ye,Y){if(!i)return;const C=o({x:Y.clientX,y:Y.clientY});i.insertPoint(t.id,ye,{x:C.x,y:C.y})}const P=n.computed(()=>de(t.data.association.end1.multiplicity)),W=n.computed(()=>de(t.data.association.end2.multiplicity)),oe=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),T=n.computed(()=>oe.value==="class"),J=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ye=Gn($.value);return{x:N.value.x+ye.x*10,y:N.value.y+ye.y*10}}return b.value[0]??y.value}),se=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Y=Gn(K.value);return{x:y.value.x+Y.x*10,y:y.value.y+Y.y*10}}const ye=b.value;return ye[ye.length-1]??N.value}),he=n.computed(()=>{const ye=t.data.association;return{multiplicity:ye.end1.multiplicity,navigable:ye.end1.navigable,composition:ye.end1.composition,otherNavigable:ye.end2.navigable}}),we=n.computed(()=>{const ye=t.data.association;return{multiplicity:ye.end2.multiplicity,navigable:ye.end2.navigable,composition:ye.end2.composition,otherNavigable:ye.end1.navigable}}),re=n.computed(()=>Vd(N.value,J.value,he.value,oe.value)),me=n.computed(()=>Vd(y.value,se.value,we.value,oe.value)),be=n.computed(()=>[...re.value.lines,...me.value.lines]),xe=n.computed(()=>[...re.value.circles,...me.value.circles]),Ce=n.computed(()=>[...re.value.polygons,...me.value.polygons].map(ye=>`M${ye.points.map(Y=>`${Y.x},${Y.y}`).join(" L")} Z`)),Se=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ye,Y)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:G.value,fill:"none",class:"em-edge__hit"},null,8,kw),n.createElementVNode("path",{d:G.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Ew),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ce.value,(C,k)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${k}`,d:C,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Se.value])},null,10,Nw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(C,k)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${k}`,x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,$w))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(xe.value,(C,k)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${k}`,cx:C.cx,cy:C.cy,r:C.r,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,xw))),128)),T.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(P.value),11,Iw),n.createElementVNode("text",{x:n.unref(y).x-8,y:n.unref(y).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,Sw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(X.value,(C,k)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${k}`,cx:C.point.x,cy:C.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(V=>E(C.segIndex,V),["stop"])},null,42,Cw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Q.value,(C,k)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${k}`,x:C.x-5,y:C.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:V=>B(k,V),onPointermove:ee,onPointerup:v,onDblclick:V=>R(k,V)},null,42,Rw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Tt=(e=>(e.Lines="lines",e.Dots="dots",e))(Tt||{});const Ld=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Pd=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Tt.Lines+"",Tt.Dots+"";const Vw={[Tt.Dots]:"#81818a",[Tt.Lines]:"#eee"},Aw=["id","x","y","width","height","patternTransform"],Tw={key:2,height:"100",width:"100"},Mw=["fill"],Bw=["x","y","fill"],Dw={name:"Background",compatConfig:{MODE:3}},Ow=n.defineComponent({...Dw,props:{id:{},variant:{default:()=>Tt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:o}=De(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,p*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||Vw[e.variant||Tt.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(Tt).Lines?(n.openBlock(),n.createBlock(n.unref(Ld),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Tt).Dots?(n.openBlock(),n.createBlock(n.unref(Pd),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Tw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Mw)])):n.createCommentVNode("",!0)])],8,Aw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Bw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Lw={name:"ControlButton",compatConfig:{MODE:3}},Pw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},zw={type:"button",class:"vue-flow__controls-button"};function Uw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",zw,[n.renderSlot(e.$slots,"default")])}const yn=Pw(Lw,[["render",Uw]]),Hw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Fw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Gw(e,t){return n.openBlock(),n.createElementBlock("svg",Hw,Fw)}const Yw={render:Gw},Ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Kw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function qw(e,t){return n.openBlock(),n.createElementBlock("svg",Ww,Kw)}const Xw={render:qw},jw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Zw=[n.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function Jw(e,t){return n.openBlock(),n.createElementBlock("svg",jw,Zw)}const Qw={render:Jw},ev={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},tv=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function nv(e,t){return n.openBlock(),n.createElementBlock("svg",ev,tv)}const ov={render:nv},iv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},av=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function lv(e,t){return n.openBlock(),n.createElementBlock("svg",iv,av)}const rv={render:lv},sv={name:"Controls",compatConfig:{MODE:3}},cv=n.defineComponent({...sv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>fc.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:l,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=De(),p=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),h=n.toRef(()=>d.value.zoom>=f.value);function b(){r(),t("zoomIn")}function g(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function N(){l(!p.value),t("interactionChange",!p.value)}return(y,$)=>(n.openBlock(),n.createBlock(n.unref(dd),{class:"vue-flow__controls",position:y.position},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"top"),y.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(y.$slots,"control-zoom-in",{},()=>[n.createVNode(yn,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Yw))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(yn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Xw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(yn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Qw))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(yn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[p.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(rv))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(ov))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var dv={value:()=>{}};function _l(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Oi(o)}function Oi(e){this._=e}function uv(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Oi.prototype=_l.prototype={constructor:Oi,on:function(e,t){var o=this._,i=uv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=fv(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=zd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=zd(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Oi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function fv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function zd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=dv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var wl="http://www.w3.org/1999/xhtml";const Ud={svg:"http://www.w3.org/2000/svg",xhtml:wl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Li(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ud.hasOwnProperty(t)?{space:Ud[t],local:e}:e}function mv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===wl&&t.documentElement.namespaceURI===wl?t.createElement(e):t.createElementNS(o,e)}}function pv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hd(e){var t=Li(e);return(t.local?pv:mv)(t)}function hv(){}function vl(e){return e==null?hv:function(){return this.querySelector(e)}}function yv(e){typeof e!="function"&&(e=vl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new rt(i,this._parents)}function gv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function bv(){return[]}function Fd(e){return e==null?bv:function(){return this.querySelectorAll(e)}}function _v(e){return function(){return gv(e.apply(this,arguments))}}function wv(e){typeof e=="function"?e=_v(e):e=Fd(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new rt(i,a)}function Gd(e){return function(){return this.matches(e)}}function Yd(e){return function(t){return t.matches(e)}}var vv=Array.prototype.find;function kv(e){return function(){return vv.call(this.children,e)}}function Ev(){return this.firstElementChild}function Nv(e){return this.select(e==null?Ev:kv(typeof e=="function"?e:Yd(e)))}var $v=Array.prototype.filter;function xv(){return Array.from(this.children)}function Iv(e){return function(){return $v.call(this.children,e)}}function Sv(e){return this.selectAll(e==null?xv:Iv(typeof e=="function"?e:Yd(e)))}function Cv(e){typeof e!="function"&&(e=Gd(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new rt(i,this._parents)}function Wd(e){return new Array(e.length)}function Rv(){return new rt(this._enter||this._groups.map(Wd),this._parents)}function Pi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Pi.prototype={constructor:Pi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Vv(e){return function(){return e}}function Av(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Pi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Tv(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Pi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Mv(e){return e.__data__}function Bv(e,t){if(!arguments.length)return Array.from(this,Mv);var o=t?Tv:Av,i=this._parents,a=this._groups;typeof e!="function"&&(e=Vv(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],p=f.length,m=Dv(e.call(u,u&&u.__data__,d,i)),h=m.length,b=s[d]=new Array(h),g=r[d]=new Array(h),_=c[d]=new Array(p);o(u,f,b,g,_,m,t);for(var N=0,y=0,$,K;N<h;++N)if($=b[N]){for(N>=y&&(y=N+1);!(K=g[y])&&++y<h;);$._next=K||null}}return r=new rt(r,i),r._enter=s,r._exit=c,r}function Dv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ov(){return new rt(this._exit||this._groups.map(Wd),this._parents)}function Lv(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function Pv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new rt(s,this._parents)}function zv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function Uv(e){e||(e=Hv);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new rt(a,this._parents).order()}function Hv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Gv(){return Array.from(this)}function Yv(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function Wv(){let e=0;for(const t of this)++e;return e}function Kv(){return!this.node()}function qv(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function Xv(e){return function(){this.removeAttribute(e)}}function jv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zv(e,t){return function(){this.setAttribute(e,t)}}function Jv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Qv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function ek(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function tk(e,t){var o=Li(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?jv:Xv:typeof t=="function"?o.local?ek:Qv:o.local?Jv:Zv)(o,t))}function Kd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nk(e){return function(){this.style.removeProperty(e)}}function ok(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ik(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function ak(e,t,o){return arguments.length>1?this.each((t==null?nk:typeof t=="function"?ik:ok)(e,t,o??"")):zn(this.node(),e)}function zn(e,t){return e.style.getPropertyValue(t)||Kd(e).getComputedStyle(e,null).getPropertyValue(t)}function lk(e){return function(){delete this[e]}}function rk(e,t){return function(){this[e]=t}}function sk(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ck(e,t){return arguments.length>1?this.each((t==null?lk:typeof t=="function"?sk:rk)(e,t)):this.node()[e]}function qd(e){return e.trim().split(/^|\s+/)}function kl(e){return e.classList||new Xd(e)}function Xd(e){this._node=e,this._names=qd(e.getAttribute("class")||"")}Xd.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function jd(e,t){for(var o=kl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Zd(e,t){for(var o=kl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function dk(e){return function(){jd(this,e)}}function uk(e){return function(){Zd(this,e)}}function fk(e,t){return function(){(t.apply(this,arguments)?jd:Zd)(this,e)}}function mk(e,t){var o=qd(e+"");if(arguments.length<2){for(var i=kl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?fk:t?dk:uk)(o,t))}function pk(){this.textContent=""}function hk(e){return function(){this.textContent=e}}function yk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function gk(e){return arguments.length?this.each(e==null?pk:(typeof e=="function"?yk:hk)(e)):this.node().textContent}function bk(){this.innerHTML=""}function _k(e){return function(){this.innerHTML=e}}function wk(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function vk(e){return arguments.length?this.each(e==null?bk:(typeof e=="function"?wk:_k)(e)):this.node().innerHTML}function kk(){this.nextSibling&&this.parentNode.appendChild(this)}function Ek(){return this.each(kk)}function Nk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $k(){return this.each(Nk)}function xk(e){var t=typeof e=="function"?e:Hd(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ik(){return null}function Sk(e,t){var o=typeof e=="function"?e:Hd(e),i=t==null?Ik:typeof t=="function"?t:vl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Ck(){var e=this.parentNode;e&&e.removeChild(this)}function Rk(){return this.each(Ck)}function Vk(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ak(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tk(e){return this.select(e?Ak:Vk)}function Mk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Bk(e){return function(t){e.call(this,t,this.__data__)}}function Dk(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Ok(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function Lk(e,t,o){return function(){var i=this.__on,a,l=Bk(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function Pk(e,t,o){var i=Dk(e+""),a,l=i.length,r;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<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?Lk:Ok,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Jd(e,t,o){var i=Kd(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function zk(e,t){return function(){return Jd(this,e,t)}}function Uk(e,t){return function(){return Jd(this,e,t.apply(this,arguments))}}function Hk(e,t){return this.each((typeof t=="function"?Uk:zk)(e,t))}function*Fk(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var Qd=[null];function rt(e,t){this._groups=e,this._parents=t}function wo(){return new rt([[document.documentElement]],Qd)}function Gk(){return this}rt.prototype=wo.prototype={constructor:rt,select:yv,selectAll:wv,selectChild:Nv,selectChildren:Sv,filter:Cv,data:Bv,enter:Rv,exit:Ov,join:Lv,merge:Pv,selection:Gk,order:zv,sort:Uv,call:Fv,nodes:Gv,node:Yv,size:Wv,empty:Kv,each:qv,attr:tk,style:ak,property:ck,classed:mk,text:gk,html:vk,raise:Ek,lower:$k,append:xk,insert:Sk,remove:Rk,clone:Tk,datum:Mk,on:Pk,dispatch:Hk,[Symbol.iterator]:Fk};function Wt(e){return typeof e=="string"?new rt([[document.querySelector(e)]],[document.documentElement]):new rt([[e]],Qd)}function Yk(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kt(e,t){if(e=Yk(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const El={capture:!0,passive:!1};function Nl(e){e.preventDefault(),e.stopImmediatePropagation()}function Wk(e){var t=e.document.documentElement,o=Wt(e).on("dragstart.drag",Nl,El);"onselectstart"in t?o.on("selectstart.drag",Nl,El):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Kk(e,t){var o=e.document.documentElement,i=Wt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Nl,El),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 $l(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function eu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function vo(){}var ko=.7,zi=1/ko,Un="\\s*([+-]?\\d+)\\s*",Eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qk=/^#([0-9a-f]{3,8})$/,Xk=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),jk=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),Zk=new RegExp(`^rgba\\(${Un},${Un},${Un},${Eo}\\)$`),Jk=new RegExp(`^rgba\\(${Et},${Et},${Et},${Eo}\\)$`),Qk=new RegExp(`^hsl\\(${Eo},${Et},${Et}\\)$`),eE=new RegExp(`^hsla\\(${Eo},${Et},${Et},${Eo}\\)$`),tu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$l(vo,No,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nu,formatHex:nu,formatHex8:tE,formatHsl:nE,formatRgb:ou,toString:ou});function nu(){return this.rgb().formatHex()}function tE(){return this.rgb().formatHex8()}function nE(){return su(this).formatHsl()}function ou(){return this.rgb().formatRgb()}function No(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=qk.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?iu(t):o===3?new it(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Ui(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Ui(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Xk.exec(e))?new it(t[1],t[2],t[3],1):(t=jk.exec(e))?new it(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Zk.exec(e))?Ui(t[1],t[2],t[3],t[4]):(t=Jk.exec(e))?Ui(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Qk.exec(e))?ru(t[1],t[2]/100,t[3]/100,1):(t=eE.exec(e))?ru(t[1],t[2]/100,t[3]/100,t[4]):tu.hasOwnProperty(e)?iu(tu[e]):e==="transparent"?new it(NaN,NaN,NaN,0):null}function iu(e){return new it(e>>16&255,e>>8&255,e&255,1)}function Ui(e,t,o,i){return i<=0&&(e=t=o=NaN),new it(e,t,o,i)}function oE(e){return e instanceof vo||(e=No(e)),e?(e=e.rgb(),new it(e.r,e.g,e.b,e.opacity)):new it}function xl(e,t,o,i){return arguments.length===1?oE(e):new it(e,t,o,i??1)}function it(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}$l(it,xl,eu(vo,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new it(gn(this.r),gn(this.g),gn(this.b),Hi(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:au,formatHex:au,formatHex8:iE,formatRgb:lu,toString:lu}));function au(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}`}function iE(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}${bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function lu(){const e=Hi(this.opacity);return`${e===1?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${e===1?")":`, ${e})`}`}function Hi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bn(e){return e=gn(e),(e<16?"0":"")+e.toString(16)}function ru(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new pt(e,t,o,i)}function su(e){if(e instanceof pt)return new pt(e.h,e.s,e.l,e.opacity);if(e instanceof vo||(e=No(e)),!e)return new pt;if(e instanceof pt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new pt(r,s,c,e.opacity)}function aE(e,t,o,i){return arguments.length===1?su(e):new pt(e,t,o,i??1)}function pt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}$l(pt,aE,eu(vo,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new pt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new pt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new it(Il(e>=240?e-240:e+120,a,i),Il(e,a,i),Il(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new pt(cu(this.h),Fi(this.s),Fi(this.l),Hi(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=Hi(this.opacity);return`${e===1?"hsl(":"hsla("}${cu(this.h)}, ${Fi(this.s)*100}%, ${Fi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cu(e){return e=(e||0)%360,e<0?e+360:e}function Fi(e){return Math.max(0,Math.min(1,e||0))}function Il(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const du=e=>()=>e;function lE(e,t){return function(o){return e+o*t}}function rE(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function sE(e){return(e=+e)==1?uu:function(t,o){return o-t?rE(t,o,e):du(isNaN(t)?o:t)}}function uu(e,t){var o=t-e;return o?lE(e,o):du(isNaN(e)?t:e)}const fu=(function e(t){var o=sE(t);function i(a,l){var r=o((a=xl(a)).r,(l=xl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=uu(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function qt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Sl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cl=new RegExp(Sl.source,"g");function cE(e){return function(){return e}}function dE(e){return function(t){return e(t)+""}}function uE(e,t){var o=Sl.lastIndex=Cl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Sl.exec(e))&&(a=Cl.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:qt(i,a)})),o=Cl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?dE(c[0].x):cE(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}var mu=180/Math.PI,Rl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pu(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*mu,skewX:Math.atan(c)*mu,scaleX:r,scaleY:s}}var Gi;function fE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rl:pu(t.a,t.b,t.c,t.d,t.e,t.f)}function mE(e){return e==null||(Gi||(Gi=document.createElementNS("http://www.w3.org/2000/svg","g")),Gi.setAttribute("transform",e),!(e=Gi.transform.baseVal.consolidate()))?Rl:(e=e.matrix,pu(e.a,e.b,e.c,e.d,e.e,e.f))}function hu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var b=m.push("translate(",null,t,null,o);h.push({i:b-4,x:qt(d,f)},{i:b-2,x:qt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(a(f)+"rotate(",null,i)-2,x:qt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(a(f)+"skewX(",null,i)-2,x:qt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var b=m.push(a(m)+"scale(",null,",",null,")");h.push({i:b-4,x:qt(d,f)},{i:b-2,x:qt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,b=p.length,g;++h<b;)f[(g=p[h]).i]=g.x(m);return f.join("")}}}var pE=hu(fE,"px, ","px)","deg)"),hE=hu(mE,", ",")",")"),yE=1e-12;function yu(e){return((e=Math.exp(e))+1/e)/2}function gE(e){return((e=Math.exp(e))-1/e)/2}function bE(e){return((e=Math.exp(2*e))-1)/(e+1)}const _E=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,b=m*m+h*h,g,_;if(b<yE)_=Math.log(p/d)/t,g=function(q){return[s+q*m,c+q*h,d*Math.exp(t*q*_)]};else{var N=Math.sqrt(b),y=(p*p-d*d+i*b)/(2*d*o*N),$=(p*p-d*d-i*b)/(2*p*o*N),K=Math.log(Math.sqrt(y*y+1)-y),F=Math.log(Math.sqrt($*$+1)-$);_=(F-K)/t,g=function(q){var G=q*_,X=yu(K),Q=d/(o*N)*(X*bE(t*G+K)-gE(K));return[s+Q*m,c+Q*h,d*X/yu(t*G+K)]}}return g.duration=_*1e3*t/Math.SQRT2,g}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Hn=0,$o=0,xo=0,gu=1e3,Yi,Io,Wi=0,_n=0,Ki=0,So=typeof performance=="object"&&performance.now?performance:Date,bu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vl(){return _n||(bu(wE),_n=So.now()+Ki)}function wE(){_n=0}function qi(){this._call=this._time=this._next=null}qi.prototype=_u.prototype={constructor:qi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vl():+o)+(t==null?0:+t),!this._next&&Io!==this&&(Io?Io._next=this:Yi=this,Io=this),this._call=e,this._time=o,Al()},stop:function(){this._call&&(this._call=null,this._time=1/0,Al())}};function _u(e,t,o){var i=new qi;return i.restart(e,t,o),i}function vE(){Vl(),++Hn;for(var e=Yi,t;e;)(t=_n-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hn}function wu(){_n=(Wi=So.now())+Ki,Hn=$o=0;try{vE()}finally{Hn=0,EE(),_n=0}}function kE(){var e=So.now(),t=e-Wi;t>gu&&(Ki-=t,Wi=e)}function EE(){for(var e,t=Yi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Yi=o);Io=e,Al(i)}function Al(e){if(!Hn){$o&&($o=clearTimeout($o));var t=e-_n;t>24?(e<1/0&&($o=setTimeout(wu,e-So.now()-Ki)),xo&&(xo=clearInterval(xo))):(xo||(Wi=So.now(),xo=setInterval(kE,gu)),Hn=1,bu(wu))}}function vu(e,t,o){var i=new qi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var NE=_l("start","end","cancel","interrupt"),$E=[],ku=0,Eu=1,Tl=2,Xi=3,Nu=4,Ml=5,ji=6;function Zi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;xE(e,o,{name:t,index:i,group:a,on:NE,tween:$E,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ku})}function Bl(e,t){var o=ht(e,t);if(o.state>ku)throw new Error("too late; already scheduled");return o}function Nt(e,t){var o=ht(e,t);if(o.state>Xi)throw new Error("too late; already running");return o}function ht(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function xE(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=_u(l,0,o.time);function l(d){o.state=Eu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==Eu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Xi)return vu(r);m.state===Nu?(m.state=ji,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=ji,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(vu(function(){o.state===Xi&&(o.state=Nu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Tl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Tl){for(o.state=Xi,a=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Ml,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Ml&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ji,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ji(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Tl&&i.state<Ml,i.state=ji,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function IE(e){return this.each(function(){Ji(this,e)})}function SE(e,t){var o,i;return function(){var a=Nt(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function CE(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Nt(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function RE(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ht(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?SE:CE)(o,e,t))}function Dl(e,t,o){var i=e._id;return e.each(function(){var a=Nt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return ht(a,i).value[t]}}function $u(e,t){var o;return(typeof t=="number"?qt:t instanceof No?fu:(o=No(t))?(t=o,fu):uE)(e,t)}function VE(e){return function(){this.removeAttribute(e)}}function AE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TE(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function ME(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function BE(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function DE(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function OE(e,t){var o=Li(e),i=o==="transform"?hE:$u;return this.attrTween(e,typeof t=="function"?(o.local?DE:BE)(o,i,Dl(this,"attr."+e,t)):t==null?(o.local?AE:VE)(o):(o.local?ME:TE)(o,i,t))}function LE(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function PE(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function zE(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&PE(e,l)),o}return a._value=t,a}function UE(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&LE(e,l)),o}return a._value=t,a}function HE(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Li(e);return this.tween(o,(i.local?zE:UE)(i,t))}function FE(e,t){return function(){Bl(this,e).delay=+t.apply(this,arguments)}}function GE(e,t){return t=+t,function(){Bl(this,e).delay=t}}function YE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FE:GE)(t,e)):ht(this.node(),t).delay}function WE(e,t){return function(){Nt(this,e).duration=+t.apply(this,arguments)}}function KE(e,t){return t=+t,function(){Nt(this,e).duration=t}}function qE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?WE:KE)(t,e)):ht(this.node(),t).duration}function XE(e,t){if(typeof t!="function")throw new Error;return function(){Nt(this,e).ease=t}}function jE(e){var t=this._id;return arguments.length?this.each(XE(t,e)):ht(this.node(),t).ease}function ZE(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Nt(this,e).ease=o}}function JE(e){if(typeof e!="function")throw new Error;return this.each(ZE(this._id,e))}function QE(e){typeof e!="function"&&(e=Gd(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Mt(i,this._parents,this._name,this._id)}function eN(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new Mt(r,this._parents,this._name,this._id)}function tN(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function nN(e,t,o){var i,a,l=tN(t)?Bl:Nt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function oN(e,t){var o=this._id;return arguments.length<2?ht(this.node(),o).on.on(e):this.each(nN(o,e,t))}function iN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function aN(){return this.on("end.remove",iN(this._id))}function lN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=vl(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Zi(d[p],t,o,p,d,ht(u,o)));return new Mt(l,this._parents,t,o)}function rN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Fd(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=ht(u,o),b=0,g=p.length;b<g;++b)(m=p[b])&&Zi(m,t,o,b,p,h);l.push(p),r.push(u)}return new Mt(l,r,t,o)}var sN=wo.prototype.constructor;function cN(){return new sN(this._groups,this._parents)}function dN(e,t){var o,i,a;return function(){var l=zn(this,e),r=(this.style.removeProperty(e),zn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function xu(e){return function(){this.style.removeProperty(e)}}function uN(e,t,o){var i,a=o+"",l;return function(){var r=zn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function fN(e,t,o){var i,a,l;return function(){var r=zn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),zn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function mN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Nt(this,e),d=c.on,u=c.value[l]==null?s||(s=xu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function pN(e,t,o){var i=(e+="")=="transform"?pE:$u;return t==null?this.styleTween(e,dN(e,i)).on("end.style."+e,xu(e)):typeof t=="function"?this.styleTween(e,fN(e,i,Dl(this,"style."+e,t))).each(mN(this._id,e)):this.styleTween(e,uN(e,i,t),o).on("end.style."+e,null)}function hN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function yN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&hN(e,r,o)),i}return l._value=t,l}function gN(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,yN(e,t,o??""))}function bN(e){return function(){this.textContent=e}}function _N(e){return function(){var t=e(this);this.textContent=t??""}}function wN(e){return this.tween("text",typeof e=="function"?_N(Dl(this,"text",e)):bN(e==null?"":e+""))}function vN(e){return function(t){this.textContent=e.call(this,t)}}function kN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&vN(a)),t}return i._value=e,i}function EN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,kN(e))}function NN(){for(var e=this._name,t=this._id,o=Iu(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=ht(c,t);Zi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(i,this._parents,e,o)}function $N(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=Nt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var xN=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Iu(){return++xN}var Bt=wo.prototype;Mt.prototype={constructor:Mt,select:lN,selectAll:rN,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:QE,merge:eN,selection:cN,transition:NN,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:oN,attr:OE,attrTween:HE,style:pN,styleTween:gN,text:wN,textTween:EN,remove:aN,tween:RE,delay:YE,duration:qE,ease:jE,easeVarying:JE,end:$N,[Symbol.iterator]:Bt[Symbol.iterator]};function IN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var SN={time:null,delay:0,duration:250,ease:IN};function CN(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function RN(e){var t,o;e instanceof Mt?(t=e._id,e=e._name):(t=Iu(),(o=SN).time=Vl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Zi(c,e,t,d,r,o||CN(c,t));return new Mt(i,this._parents,e,t)}wo.prototype.interrupt=IE,wo.prototype.transition=RN;const Qi=e=>()=>e;function VN(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Dt(e,t,o){this.k=e,this.x=t,this.y=o}Dt.prototype={constructor:Dt,scale:function(e){return e===1?this:new Dt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Dt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ol=new Dt(1,0,0);Dt.prototype;function Ll(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function AN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function TN(){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 Su(){return this.__zoom||Ol}function MN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function BN(){return navigator.maxTouchPoints||"ontouchstart"in this}function DN(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function ON(){var e=AN,t=TN,o=DN,i=MN,a=BN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=_E,d=_l("start","zoom","end"),u,f,p,m=500,h=150,b=0,g=10;function _(v){v.property("__zoom",Su).on("wheel.zoom",G,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",Q).filter(a).on("touchstart.zoom",de).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(v,R,E,P){var W=v.selection?v.selection():v;W.property("__zoom",Su),v!==W?K(v,R,E,P):W.interrupt().each(function(){F(this,arguments).event(P).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},_.scaleBy=function(v,R,E,P){_.scaleTo(v,function(){var W=this.__zoom.k,oe=typeof R=="function"?R.apply(this,arguments):R;return W*oe},E,P)},_.scaleTo=function(v,R,E,P){_.transform(v,function(){var W=t.apply(this,arguments),oe=this.__zoom,T=E==null?$(W):typeof E=="function"?E.apply(this,arguments):E,J=oe.invert(T),se=typeof R=="function"?R.apply(this,arguments):R;return o(y(N(oe,se),T,J),W,r)},E,P)},_.translateBy=function(v,R,E,P){_.transform(v,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),r)},null,P)},_.translateTo=function(v,R,E,P,W){_.transform(v,function(){var oe=t.apply(this,arguments),T=this.__zoom,J=P==null?$(oe):typeof P=="function"?P.apply(this,arguments):P;return o(Ol.translate(J[0],J[1]).scale(T.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof E=="function"?-E.apply(this,arguments):-E),oe,r)},P,W)};function N(v,R){return R=Math.max(l[0],Math.min(l[1],R)),R===v.k?v:new Dt(R,v.x,v.y)}function y(v,R,E){var P=R[0]-E[0]*v.k,W=R[1]-E[1]*v.k;return P===v.x&&W===v.y?v:new Dt(v.k,P,W)}function $(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function K(v,R,E,P){v.on("start.zoom",function(){F(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){F(this,arguments).event(P).end()}).tween("zoom",function(){var W=this,oe=arguments,T=F(W,oe).event(P),J=t.apply(W,oe),se=E==null?$(J):typeof E=="function"?E.apply(W,oe):E,he=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),we=W.__zoom,re=typeof R=="function"?R.apply(W,oe):R,me=c(we.invert(se).concat(he/we.k),re.invert(se).concat(he/re.k));return function(be){if(be===1)be=re;else{var xe=me(be),Ce=he/xe[2];be=new Dt(Ce,se[0]-xe[0]*Ce,se[1]-xe[1]*Ce)}T.zoom(null,be)}})}function F(v,R,E){return!E&&v.__zooming||new q(v,R)}function q(v,R){this.that=v,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,R),this.taps=0}q.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,R){return this.mouse&&v!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var R=Wt(this.that).datum();d.call(v,this.that,new VN(v,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),R)}};function G(v,...R){if(!e.apply(this,arguments))return;var E=F(this,R).event(v),P=this.__zoom,W=Math.max(l[0],Math.min(l[1],P.k*Math.pow(2,i.apply(this,arguments)))),oe=Kt(v);if(E.wheel)(E.mouse[0][0]!==oe[0]||E.mouse[0][1]!==oe[1])&&(E.mouse[1]=P.invert(E.mouse[0]=oe)),clearTimeout(E.wheel);else{if(P.k===W)return;E.mouse=[oe,P.invert(oe)],Ji(this),E.start()}Co(v),E.wheel=setTimeout(T,h),E.zoom("mouse",o(y(N(P,W),E.mouse[0],E.mouse[1]),E.extent,r));function T(){E.wheel=null,E.end()}}function X(v,...R){if(p||!e.apply(this,arguments))return;var E=v.currentTarget,P=F(this,R,!0).event(v),W=Wt(v.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),oe=Kt(v,E),T=v.clientX,J=v.clientY;Wk(v.view),Ll(v),P.mouse=[oe,this.__zoom.invert(oe)],Ji(this),P.start();function se(we){if(Co(we),!P.moved){var re=we.clientX-T,me=we.clientY-J;P.moved=re*re+me*me>b}P.event(we).zoom("mouse",o(y(P.that.__zoom,P.mouse[0]=Kt(we,E),P.mouse[1]),P.extent,r))}function he(we){W.on("mousemove.zoom mouseup.zoom",null),Kk(we.view,P.moved),Co(we),P.event(we).end()}}function Q(v,...R){if(e.apply(this,arguments)){var E=this.__zoom,P=Kt(v.changedTouches?v.changedTouches[0]:v,this),W=E.invert(P),oe=E.k*(v.shiftKey?.5:2),T=o(y(N(E,oe),P,W),t.apply(this,R),r);Co(v),s>0?Wt(this).transition().duration(s).call(K,T,P,v):Wt(this).call(_.transform,T,P,v)}}function de(v,...R){if(e.apply(this,arguments)){var E=v.touches,P=E.length,W=F(this,R,v.changedTouches.length===P).event(v),oe,T,J,se;for(Ll(v),T=0;T<P;++T)J=E[T],se=Kt(J,this),se=[se,this.__zoom.invert(se),J.identifier],W.touch0?!W.touch1&&W.touch0[2]!==se[2]&&(W.touch1=se,W.taps=0):(W.touch0=se,oe=!0,W.taps=1+!!u);u&&(u=clearTimeout(u)),oe&&(W.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),Ji(this),W.start())}}function B(v,...R){if(this.__zooming){var E=F(this,R).event(v),P=v.changedTouches,W=P.length,oe,T,J,se;for(Co(v),oe=0;oe<W;++oe)T=P[oe],J=Kt(T,this),E.touch0&&E.touch0[2]===T.identifier?E.touch0[0]=J:E.touch1&&E.touch1[2]===T.identifier&&(E.touch1[0]=J);if(T=E.that.__zoom,E.touch1){var he=E.touch0[0],we=E.touch0[1],re=E.touch1[0],me=E.touch1[1],be=(be=re[0]-he[0])*be+(be=re[1]-he[1])*be,xe=(xe=me[0]-we[0])*xe+(xe=me[1]-we[1])*xe;T=N(T,Math.sqrt(be/xe)),J=[(he[0]+re[0])/2,(he[1]+re[1])/2],se=[(we[0]+me[0])/2,(we[1]+me[1])/2]}else if(E.touch0)J=E.touch0[0],se=E.touch0[1];else return;E.zoom("touch",o(y(T,J,se),E.extent,r))}}function ee(v,...R){if(this.__zooming){var E=F(this,R).event(v),P=v.changedTouches,W=P.length,oe,T;for(Ll(v),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),oe=0;oe<W;++oe)T=P[oe],E.touch0&&E.touch0[2]===T.identifier?delete E.touch0:E.touch1&&E.touch1[2]===T.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(T=Kt(T,this),Math.hypot(f[0]-T[0],f[1]-T[1])<g)){var J=Wt(this).on("dblclick.zoom");J&&J.apply(this,arguments)}}}return _.wheelDelta=function(v){return arguments.length?(i=typeof v=="function"?v:Qi(+v),_):i},_.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Qi(!!v),_):e},_.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:Qi(!!v),_):a},_.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Qi([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),_):t},_.scaleExtent=function(v){return arguments.length?(l[0]=+v[0],l[1]=+v[1],_):[l[0],l[1]]},_.translateExtent=function(v){return arguments.length?(r[0][0]=+v[0][0],r[1][0]=+v[1][0],r[0][1]=+v[0][1],r[1][1]=+v[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(v){return arguments.length?(o=v,_):o},_.duration=function(v){return arguments.length?(s=+v,_):s},_.interpolate=function(v){return arguments.length?(c=v,_):c},_.on=function(){var v=d.on.apply(d,arguments);return v===d?_:v},_.clickDistance=function(v){return arguments.length?(b=(v=+v)*v,_):Math.sqrt(b)},_.tapDistance=function(v){return arguments.length?(g=+v,_):g},_}const Cu=Symbol("MiniMapSlots"),LN=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],PN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},zN=n.defineComponent({...PN,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(Cu),a=n.useAttrs(),l=n.toRef(()=>a.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,p)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||l.value.background||l.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,LN))],64)):n.createCommentVNode("",!0)}}),UN=["width","height","viewBox","aria-labelledby"],HN=["id"],FN=["d","fill","stroke","stroke-width"],GN={name:"MiniMap",compatConfig:{MODE:3}},YN=n.defineComponent({...GN,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:h}=De(),b=n.ref();n.provide(Cu,o);const g=n.toRef(()=>{var W;return e.width??((W=i.style)==null?void 0:W.width)??a}),_=n.toRef(()=>{var W;return e.height??((W=i.style)==null?void 0:W.height)??l}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),$=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),K=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),F=n.computed(()=>Qa(h.value.filter(W=>!W.hidden))),q=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),G=n.computed(()=>h.value&&h.value.length?zg(F.value,q.value):q.value),X=n.computed(()=>{const W=G.value.width/g.value,oe=G.value.height/_.value;return Math.max(W,oe)}),Q=n.computed(()=>{const W=X.value*g.value,oe=X.value*_.value,T=e.offsetScale*X.value;return{offset:T,x:G.value.x-(W-G.value.width)/2-T,y:G.value.y-(oe-G.value.height)/2-T,width:W+T*2,height:oe+T*2}}),de=n.computed(()=>!Q.value.x||!Q.value.y?"":`
28
+ M${Q.value.x-Q.value.offset},${Q.value.y-Q.value.offset}
29
+ h${Q.value.width+Q.value.offset*2}
30
+ v${Q.value.height+Q.value.offset*2}
31
+ h${-Q.value.width-Q.value.offset*2}z
32
+ M${q.value.x+e.maskBorderRadius},${q.value.y}
33
+ h${q.value.width-2*e.maskBorderRadius}
34
34
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
35
- v${J.value.height-2*e.maskBorderRadius}
35
+ v${q.value.height-2*e.maskBorderRadius}
36
36
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
37
- h${-(J.value.width-2*e.maskBorderRadius)}
37
+ h${-(q.value.width-2*e.maskBorderRadius)}
38
38
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
39
- v${-(J.value.height-2*e.maskBorderRadius)}
40
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(_.value){const Z=Mt(_.value),A=me=>{if(me.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const pe=me.sourceEvent.ctrlKey&&Xn()?10:1,de=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,q=c.value.zoom*2**(de*pe);m.value.scaleTo(p.value,q)},U=me=>{if(me.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const pe=ee.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),de={x:c.value.x-me.sourceEvent.movementX*pe,y:c.value.y-me.sourceEvent.movementY*pe},q=[[0,0],[u.value.width,u.value.height]],ce=ma.translate(de.x,de.y).scale(c.value.zoom),Ee=m.value.constrain()(ce,q,d.value);m.value.transform(p.value,Ee)},Q=bN().wheelDelta(me=>Rl(me)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?A:()=>{});Z.call(Q),H(()=>{Z.on("zoom",null)})}},{flush:"post"});function O(H){const[Z,A]=Bt(H);t("click",{event:H,position:{x:Z,y:A}})}function fe(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeClick(A),t("nodeClick",A)}function w(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeDoubleClick(A),t("nodeDblclick",A)}function R(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseEnter(A),t("nodeMouseenter",A)}function x(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseMove(A),t("nodeMousemove",A)}function G(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseLeave(A),t("nodeMouseleave",A)}return(H,Z)=>(n.openBlock(),n.createBlock(n.unref(xc),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:_,width:k.value,height:b.value,viewBox:[F.value.x,F.value.y,F.value.width,F.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:O},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,NN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(g),A=>(n.openBlock(),n.createBlock(wN,{id:A.id,key:A.id,f:"",position:A.computedPosition,dimensions:A.dimensions,selected:A.selected,dragging:A.dragging,style:n.normalizeStyle(A.style),class:n.normalizeClass(X.value(A)),color:h.value(A),"border-radius":H.nodeBorderRadius,"stroke-color":S.value(A),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref($),type:A.type,hidden:A.hidden,onClick:U=>fe(U,A),onDblclick:U=>w(U,A),onMouseenter:U=>R(U,A),onMousemove:U=>x(U,A),onMouseleave:U=>G(U,A)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:K.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,kN)],8,EN))]),_:1},8,["position","class"]))}}),IN=["d"],SN=["cx","cy","onDblclick"],CN=["x","y","onPointerdown","onDblclick"],RN=Ae(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ce(),i=n.inject(Xl),l=n.inject(Jt,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(_n,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>c.value.map((T,ee)=>ee===d.value?u.value:T)),{source:p,target:m,sourceSide:g,targetSide:_}=Jc({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),k=n.computed(()=>(l==null?void 0:l.routingMode.value)==="orthogonal"?Bi(p.value,g.value,f.value,m.value,_.value):Oi(p.value,f.value,m.value)),b=n.computed(()=>a.value?(l==null?void 0:l.routingMode.value)==="orthogonal"?Di(p.value,g.value,f.value,m.value,_.value):zi(p.value,f.value,m.value).map((T,ee)=>({point:T,segIndex:ee})):[]),$=n.computed(()=>a.value?f.value:[]);function h(T,ee){d.value=T,u.value={...c.value[T]},ee.target.setPointerCapture(ee.pointerId),ee.stopPropagation()}function S(T){if(d.value<0)return;const ee=o({x:T.clientX,y:T.clientY});u.value={x:ee.x,y:ee.y}}function X(T){var ee,F;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(F=(ee=T.target).releasePointerCapture)==null||F.call(ee,T.pointerId)}function W(T,ee){ee.stopPropagation(),i==null||i.removePoint(t.id,T)}function J(T,ee){if(!i)return;const F=o({x:ee.clientX,y:ee.clientY});i.insertPoint(t.id,T,{x:F.x,y:F.y})}return(T,ee)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:k.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,IN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(F,K)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${K}`,cx:F.point.x,cy:F.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(O=>J(F.segIndex,O),["stop"])},null,42,SN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($.value,(F,K)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${K}`,x:F.x-5,y:F.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:O=>h(K,O),onPointermove:S,onPointerup:X,onDblclick:O=>W(K,O)},null,42,CN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),VN=["data-theme"],AN={key:0,class:"em-ctx__sep",role:"separator"},TN={key:1,class:"em-ctx__swatches"},MN={class:"em-ctx__swatches-label"},BN={class:"em-ctx__chips"},DN=["onClick"],ON=["title","onClick"],LN=["disabled","onClick"],PN={class:"em-ctx__icon"},zN={class:"em-ctx__caption"},UN=Ae(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),l=n.ref(void 0),a=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,g){var b;i.value=g,l.value=(b=m.target)!=null&&b.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const _=a.value;if(!_)return;const k=_.getBoundingClientRect();r.x+k.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-k.width)),r.y+k.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-k.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function p(m,g){m.onPick(g),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,g)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:a,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:g[0]||(g[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(_,k)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:k},[_.type==="separator"?(n.openBlock(),n.createElementBlock("div",AN)):_.type==="swatches"?(n.openBlock(),n.createElementBlock("div",TN,[n.createElementVNode("span",MN,n.toDisplayString(_.caption),1),n.createElementVNode("div",BN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":_.current===null}]),title:"없음",onClick:b=>p(_,null)},null,10,DN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),b=>(n.openBlock(),n.createElementBlock("button",{key:b,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":_.current===b}]),style:n.normalizeStyle({background:n.unref(ai)(b)}),title:n.unref(li)(b),onClick:$=>p(_,b)},null,14,ON))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":_.danger,"is-disabled":_.disabled}]),disabled:_.disabled,role:"menuitem",onClick:b=>f(_)},[n.createElementVNode("span",PN,[_.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:_.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",zN,n.toDisplayString(_.caption),1)],10,LN))],64))),128))],36)],8,VN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),ha=[".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 Nn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function HN(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function FN(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},l=document.createRange();l.selectNodeContents(e);const a=e.firstChild,r=l.getClientRects();if(!a||a.nodeType!==3||r.length<=1){const g=r.length?l.getBoundingClientRect():e.getBoundingClientRect();if(g.width===0&&g.height===0)return[];const _=t(g.left,g.top+g.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=a.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const g=d.trim();if(g){const _=t(f,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:g})}d=""};for(let g=0;g<s.length;g++){l.setStart(a,g),l.setEnd(a,g+1);const _=l.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(m(),u=_.top,f=_.left,p=_.bottom,d=s[g]):(d+=s[g],p=Math.max(p,_.bottom))}return m(),c}function Ti(e,t){const o=[];for(const i of e.querySelectorAll("*"))HN(i)&&(i.closest(ha)||Nn(i)&&o.push(...FN(i,t)));return o}function ro(e){return Math.round(e*100)/100}function GN(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(ha)||!Nn(i))continue;const l=i.getBoundingClientRect();if(l.width===0||l.height===0)continue;const a=t(l.left,l.top),r=t(l.right,l.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ro(a.x)}" y="${ro(a.y)}" width="${ro(r.x-a.x)}" height="${ro(r.y-a.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function YN(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Nn(o))continue;const i=getComputedStyle(o),l=i.stroke,a=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>ro(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${l}" stroke-width="${a}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${l}" stroke-width="${a}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${l}" stroke-width="${a}" stroke-linejoin="round" />`)}return t}function Wd(e,t,o){const i=[];for(const l of e.querySelectorAll("*")){if(l===t||l.closest(ha)||!Nn(l))continue;const a=getComputedStyle(l),r=parseFloat(a.borderTopWidth);if(!r)continue;const s=l.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:a.borderTopColor,strokeWidth:r})}return i}function so(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),l=t(o.left,o.top),a=t(o.right,o.bottom),r=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:l.x,y:l.y,w:a.x-l.x,h:a.y-l.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function ga(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function WN(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,g)=>e.screenToFlowCoordinate({x:m,y:g}),i=[],l=[],a=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const g=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!g||!Nn(g))continue;const _=g.firstElementChild;if(_)if(m.type==="group"){const k=so(_,o);ga(s,k),i.push({...k,texts:[]});const b=_.querySelector(".em-group__label");b&&i.push({...so(b,o),stroke:"none",texts:[]}),i.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ti(_,o)})}else if(m.type==="note"){const k={...so(_,o),texts:Ti(_,o),lines:Wd(_,_,o)};ga(s,k),a.push(k)}else{const k=so(_,o);ga(s,k);const b=k.radius??{tl:0,tr:0};l.push({...k,stroke:"none",texts:[]});const $=_.querySelector(".em-entity__header");if($){const h=so($,o);l.push({x:k.x,y:k.y,w:k.w,h:h.y+h.h-k.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}l.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ti(_,o),lines:Wd(_,_,o),icons:GN(_,o)}),l.push({...k,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const g=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!g||!Nn(g))continue;const _=g.getAttribute("d");if(!_)continue;const k=getComputedStyle(g),b=k.strokeDasharray,$=YN(m);r.push({d:_,stroke:k.stroke,strokeWidth:parseFloat(k.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Ti(m,o),markers:$.length?$:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:l,notes:a}}function Kd(e){return $a(WN(e))}function Xd(e,t="diagram.svg"){const o=Kd(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(i);try{const a=document.createElement("a");a.href=l,a.download=t,document.body.appendChild(a),a.click(),a.remove()}finally{URL.revokeObjectURL(l)}}const ya="nc:",qd=Ae(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=te.useModal(),a=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(y){s.x=y.clientX,s.y=y.clientY}const d=n.ref(null);n.provide(fi,d);const u=n.ref(null);n.provide(Dc,u);const f=n.ref(null),p=n.computed(()=>{const y=f.value,L=new Set;if(!y)return L;if(y.kind==="entity")L.add(y.id);else if(y.kind==="group"){const ae=i.resolved.value.groups.find(ue=>ue.group.modelId===y.id);for(const ue of(ae==null?void 0:ae.group.memberEntityRefs)??[])L.add(ue)}return L}),m=n.computed(()=>{const y=f.value,L=new Set(p.value),ae=new Set,ue=new Set;if(!y)return{related:L,edges:ae,notes:ue};if(y.kind==="note"){ue.add(y.id);for(const P of i.resolved.value.noteConnections)P.noteRef===y.id&&L.add(P.targetRef);return{related:L,edges:ae,notes:ue}}const ge=p.value;if(!ge.size)return{related:L,edges:ae,notes:ue};for(const P of i.resolved.value.associations){const{end1:Y,end2:z}=P.association;(ge.has(Y.entityRef)||ge.has(z.entityRef))&&(ae.add(P.association.modelId),L.add(Y.entityRef),L.add(z.entityRef))}for(const P of i.resolved.value.noteConnections)L.has(P.targetRef)&&ue.add(P.noteRef);return{related:L,edges:ae,notes:ue}});n.provide(_n,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:p,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var y;return((y=f.value)==null?void 0:y.kind)==="group"?f.value.id:null}),setEntityHover:y=>{u.value||r.value||(f.value=y?{kind:"entity",id:y}:null)},setGroupHover:y=>{u.value||r.value||(f.value=y?{kind:"group",id:y}:null)},setNoteHover:y=>{u.value||r.value||(f.value=y?{kind:"note",id:y}:null)}}),n.provide(Jt,i);function g(y,L){return`${ya}${y}:${L}`}function _(y){if(!y.startsWith(ya))return null;const[L,ae]=y.slice(ya.length).split(":");return L&&ae?{noteRef:L,targetRef:ae}:null}n.provide(Xl,{points:y=>{var ae,ue;const L=_(y);return L?((ae=i.resolved.value.noteConnections.find(ge=>ge.noteRef===L.noteRef&&ge.targetRef===L.targetRef))==null?void 0:ae.waypoints)??[]:((ue=i.resolved.value.associations.find(ge=>ge.association.modelId===y))==null?void 0:ue.waypoints)??[]},movePoint:(y,L,ae)=>{const ue=_(y);ue?i.moveNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,ae):i.moveWaypoint(y,L,ae)},insertPoint:(y,L,ae)=>{const ue=_(y);ue?i.addNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,ae):i.addWaypoint(y,L,ae)},removePoint:(y,L)=>{const ae=_(y);ae?i.removeNoteConnectionWaypoint(ae.noteRef,ae.targetRef,L):i.removeWaypoint(y,L)}});const k=Ce(),{nodes:b,edges:$,findNode:h,findEdge:S,addNodes:X,addEdges:W,removeNodes:J,removeEdges:T,fitView:ee,setCenter:F,getViewport:K,screenToFlowCoordinate:O,getSelectedNodes:fe}=k,w=n.ref(!1);async function R(){w.value=!0,await n.nextTick(),await new Promise(y=>requestAnimationFrame(()=>y(null)));try{Xd(k)}finally{w.value=!1}}t({exportSvg:R});function x(y){for(const L of i.resolved.value.groups){const{location:ae,size:ue}=L.geo;if(y.x>=ae.x&&y.x<=ae.x+ue.width&&y.y>=ae.y&&y.y<=ae.y+ue.height)return L.group.modelId}return null}function G(){const y=i.resolved.value,L=new Map(y.groups.map(Y=>[Y.group.modelId,Y.geo])),ae=new Set(y.groups.map(Y=>Y.group.modelId)),ue=new Set([...ae,...y.entities.map(Y=>Y.entity.modelId),...y.notes.map(Y=>Y.note.modelId)]);for(const Y of[...b.value])ue.has(Y.id)||J([Y.id]);for(const Y of y.groups){const z=Y.group.modelId,j={width:`${Y.geo.size.width}px`,height:`${Y.geo.size.height}px`},ne={group:Y.group,style:Y.style},se=h(z);se?(se.position={...Y.geo.location},se.data=ne,se.style=j):X([{id:z,type:"group",position:{...Y.geo.location},style:j,data:ne}])}for(const Y of y.entities){const z=Y.entity.modelId,j=Y.groupRef&&ae.has(Y.groupRef)?Y.groupRef:void 0,ne={entity:Y.entity,displayMode:i.displayMode.value,collapsed:Y.collapsed,groupRef:j,size:Y.geo.size,style:Y.style,attributeStyles:Y.attributeStyles,operationStyles:Y.operationStyles},se=j?L.get(j):void 0,be=se?{x:Y.geo.location.x-se.location.x,y:Y.geo.location.y-se.location.y}:{...Y.geo.location},re=h(z);re?(re.position=be,re.data=ne,re.parentNode=j):X([{id:z,type:"entity",position:be,parentNode:j,data:ne}])}for(const Y of y.notes){const z=Y.note,j=z.modelId,ne=Y.groupRef&&ae.has(Y.groupRef)?Y.groupRef:void 0,se={note:z,groupRef:ne},be={width:`${z.geo.size.width}px`,height:`${z.geo.size.height}px`},re=ne?L.get(ne):void 0,we=re?{x:z.geo.location.x-re.location.x,y:z.geo.location.y-re.location.y}:{...z.geo.location},Ie=h(j);Ie?(Ie.position=we,Ie.data=se,Ie.style=be,Ie.parentNode=ne):X([{id:j,type:"note",position:we,parentNode:ne,style:be,data:se}])}const ge=new Map(y.associations.map(Y=>[Y.association.modelId,Y])),P=new Set(y.noteConnections.map(Y=>g(Y.noteRef,Y.targetRef)));for(const Y of[...$.value])!ge.has(Y.id)&&!P.has(Y.id)&&T([Y.id]);for(const[Y,z]of ge){const j={id:Y,type:"association",source:z.association.end1.entityRef,target:z.association.end2.entityRef,sourceHandle:z.sourceColumnRef?`r:${z.sourceColumnRef}`:void 0,targetHandle:z.targetColumnRef?`l:${z.targetColumnRef}`:void 0,data:{association:z.association,sourceColumnRef:z.sourceColumnRef,targetColumnRef:z.targetColumnRef}},ne=S(Y);ne?(ne.data=j.data,ne.sourceHandle=j.sourceHandle,ne.targetHandle=j.targetHandle):W([j])}for(const Y of y.noteConnections){const z=g(Y.noteRef,Y.targetRef),j={noteRef:Y.noteRef,targetRef:Y.targetRef},ne=S(z);ne?ne.data=j:W([{id:z,type:"note-connection",source:Y.noteRef,target:Y.targetRef,data:j}])}}function H(){const y=fe.value.map(ae=>ae.id);if(y.length)return y;const L=i.selection.value;return L&&(L.kind==="entity"||L.kind==="note"||L.kind==="group")?[L.id]:[]}function Z(y){var ge;const L=y.target;if(L&&(L.tagName==="INPUT"||L.tagName==="TEXTAREA"||L.isContentEditable))return;if(!i.editable.value){(y.metaKey||y.ctrlKey)&&y.key.toLowerCase()==="c"&&(i.copy(),y.preventDefault());return}if(y.key==="Delete"||y.key==="Backspace"){i.deleteSelection()&&y.preventDefault();return}if(y.key==="ArrowUp"||y.key==="ArrowDown"||y.key==="ArrowLeft"||y.key==="ArrowRight"){if(((ge=i.selection.value)==null?void 0:ge.kind)==="attribute"){if(y.key==="ArrowUp"||y.key==="ArrowDown"){const j=y.key==="ArrowDown"?1:-1;(y.altKey?i.nudgeSelectedAttributes(j):i.moveAttributeFocus(j))&&y.preventDefault()}return}const P=y.shiftKey?10:1,Y=y.key==="ArrowLeft"?-P:y.key==="ArrowRight"?P:0,z=y.key==="ArrowUp"?-P:y.key==="ArrowDown"?P:0;i.nudgeNodes(H(),Y,z)&&y.preventDefault();return}if(!(y.metaKey||y.ctrlKey))return;const ue=y.key.toLowerCase();ue==="c"?(i.copy(),y.preventDefault()):ue==="v"?(i.paste(),y.preventDefault()):ue==="z"&&(y.shiftKey?i.redo():i.undo(),y.preventDefault())}n.onMounted(async()=>{G(),await n.nextTick(),ee(),window.addEventListener("keydown",Z),window.addEventListener("pointerup",A),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Z),window.removeEventListener("pointerup",A),window.removeEventListener("pointermove",c)});function A(){d.value=null}function U(){r.value=!0,f.value=null}function Q(){var ue;r.value=!1;const y=(ue=document.elementFromPoint(s.x,s.y))==null?void 0:ue.closest(".vue-flow__node"),L=y==null?void 0:y.dataset.id;if(!L){f.value=null;return}const ae=y.classList.contains("vue-flow__node-group")?"group":y.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:ae,id:L}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],G),n.watch(()=>i.resolved.value,y=>{const L=f.value;if(!L)return;(L.kind==="entity"?y.entities.some(ue=>ue.entity.modelId===L.id):L.kind==="group"?y.groups.some(ue=>ue.group.modelId===L.id):y.notes.some(ue=>ue.note.modelId===L.id))||(f.value=null)});function me(y){const L=y.computedPosition??y.position,ae=y.dimensions??{width:0,height:0};return{x:L.x+ae.width/2,y:L.y+ae.height/2}}function pe(y){const L=y.node;if(L){if(f.value=null,L.type==="group"){const ae=i.resolved.value.groups.find(ue=>ue.group.modelId===L.id);u.value=ae?{groupId:L.id,dx:L.position.x-ae.geo.location.x,dy:L.position.y-ae.geo.location.y}:null,d.value=null;return}if(L.type!=="entity"&&L.type!=="note"){d.value=null;return}d.value=x(me(L))}}function de(y){var ue;d.value=null,u.value=null;const L=(ue=y.nodes)!=null&&ue.length?y.nodes:[y.node],ae=L.filter(ge=>(ge==null?void 0:ge.type)==="group");if(ae.length){for(const ge of ae){if(!ge)continue;const P=i.resolved.value.entities.filter(Y=>Y.groupRef===ge.id).map(Y=>{const z=h(Y.entity.modelId),j=(z==null?void 0:z.computedPosition)??(z==null?void 0:z.position)??{x:0,y:0};return{id:Y.entity.modelId,location:{x:j.x,y:j.y}}});i.dragGroup(ge.id,{x:ge.position.x,y:ge.position.y},P)}return}for(const ge of L){if(!ge||ge.type==="group")continue;const P=ge.computedPosition??ge.position,Y=ge.dimensions??{width:0,height:0},z={x:P.x+Y.width/2,y:P.y+Y.height/2};ge.type==="note"?i.dropNote(ge.id,{x:P.x,y:P.y},x(z)):i.dropEntity(ge.id,{x:P.x,y:P.y},x(z))}}function q(y){var j,ne,se,be,re;if(!i.editable.value||!y.source||!y.target)return;const L=((j=h(y.source))==null?void 0:j.type)==="note",ae=((ne=h(y.target))==null?void 0:ne.type)==="note";if(L||ae){if(L&&ae)return;const we=L?y.source:y.target,Ie=L?y.target:y.source;((se=h(Ie))==null?void 0:se.type)==="entity"&&i.addNoteConnection(we,Ie);return}const ue=we=>{var Ie;return(Ie=i.state.logical.entities.find(Re=>Re.modelId===we))==null?void 0:Ie.stereotype},ge=ue(y.source)==="JPA_EMBEDDABLE",P=ue(y.target)==="JPA_EMBEDDABLE";if(ge||P){if(ge&&P)return;const we=ge?y.source:y.target,Ie=ge?y.target:y.source;i.addEmbedAssociation(Ie,we);return}const Y=(be=y.sourceHandle)!=null&&be.startsWith("r:")?y.sourceHandle.slice(2):void 0,z=(re=y.targetHandle)!=null&&re.startsWith("l:")?y.targetHandle.slice(2):void 0;i.addAssociation(y.source,y.target,Y,z)}const ce=n.ref(null);function Ee(y,L){var ue;const ae=i.state.layout.entityLayouts.find(ge=>ge.entityRef===y);return tt((ue=ae==null?void 0:ae.attributeStyles)==null?void 0:ue[L])}function $e(y,L){var ue;const ae=i.state.layout.entityLayouts.find(ge=>ge.entityRef===y);return tt((ue=ae==null?void 0:ae.operationStyles)==null?void 0:ue[L])}function ke(y){var ue,ge;if(y.preventDefault(),!i.editable.value)return;const L=()=>O({x:y.clientX,y:y.clientY}),ae=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const P=L();i.addEntity("NewEntity",{x:P.x,y:P.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const P=L();i.addNote("메모",{x:P.x,y:P.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const P=L();i.addEmptyGroup({x:P.x,y:P.y})}}];((ue=i.clipboard.value)==null?void 0:ue.kind)==="entity"&&ae.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ae.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(ge=ce.value)==null||ge.open(y,ae)}function he({event:y,node:L}){var se,be,re,we,Ie,Re,Ze,Ot,Lt,ye,Oe,He,co,uo,fo,mo,po;const ae=y;if(ae.preventDefault(),!i.editable.value){if(L.type==="group"||L.type==="note")return;const Te=(be=(se=ae.target)==null?void 0:se.closest("[data-attr]"))==null?void 0:be.dataset.attr;if(Te){const De=i.selection.value;(De==null?void 0:De.kind)==="attribute"&&De.entityId===L.id&&De.ids.includes(Te)||i.selectAttribute(L.id,Te);const on=((re=i.selection.value)==null?void 0:re.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[Te];(we=ce.value)==null||we.open(ae,[{caption:on.length>1?`복사 (${on.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ie=ce.value)==null||Ie.open(ae,[{caption:"상세 편집…",icon:"pencil",handler:()=>si(l,i,L.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}}]);return}if(L.type==="group"){(Re=ce.value)==null||Re.open(ae,[{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(L.id)}]);return}if(L.type==="note"){(Ze=ce.value)==null||Ze.open(ae,[{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(L.id)}]);return}const ue=(Lt=(Ot=ae.target)==null?void 0:Ot.closest("[data-attr]"))==null?void 0:Lt.dataset.attr;if(ue){const Te=i.selection.value;(Te==null?void 0:Te.kind)==="attribute"&&Te.entityId===L.id&&Te.ids.includes(ue)||i.selectAttribute(L.id,ue);const nn=((ye=i.selection.value)==null?void 0:ye.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[ue],on=nn.length>1,ba=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{type:"swatches",caption:on?`색상 (${nn.length})`:"색상",current:on?null:Ee(L.id,ue),onPick:Hx=>i.setAttributeSwatches(L.id,nn,Hx)},{type:"separator"},{caption:on?`복사 (${nn.length})`:"복사",icon:"copy",handler:()=>i.copy()}],ho=i.clipboard.value;(ho==null?void 0:ho.kind)==="attribute"&&ba.push({caption:ho.attributes.length>1?`속성 붙여넣기 (${ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),ba.push({type:"separator"},{caption:on?`속성 삭제 (${nn.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(L.id,nn)}),(Oe=ce.value)==null||Oe.open(ae,ba);return}const ge=(co=(He=ae.target)==null?void 0:He.closest("[data-op]"))==null?void 0:co.dataset.op;if(ge){(uo=ce.value)==null||uo.open(ae,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(L.id)},{type:"swatches",caption:"색상",current:$e(L.id,ge),onPick:Te=>i.setOperationSwatch(L.id,ge,Te)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(L.id,ge)}]);return}const P=[{caption:"상세 편집…",icon:"pencil",handler:()=>si(l,i,L.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(L.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Te=fe.value.filter(De=>De.type==="entity").map(De=>De.id);i.createGroup(Te.includes(L.id)&&Te.length?Te:[L.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(L.id,L.id)}],Y=i.embeddableCatalog.value;if(Y.length){P.push({type:"separator"});for(const Te of Y){const De=((fo=Te.label)==null?void 0:fo.ko)??((mo=Te.label)==null?void 0:mo.en)??Te.type;P.push({caption:`임베더블 추가: ${De}`,icon:"link",handler:()=>i.addPredefinedEmbed(L.id,Te.type)})}}const z=i.resolved.value.entities.find(Te=>Te.entity.modelId===L.id);P.push({type:"separator"}),P.push({caption:z!=null&&z.collapsed?"펼치기":"접기",icon:z!=null&&z.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(L.id,!(z!=null&&z.collapsed))}),(z==null?void 0:z.groupRef)&&P.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(L.id)}),P.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}});const ne=i.clipboard.value;(ne==null?void 0:ne.kind)==="attribute"&&P.push({caption:ne.attributes.length>1?`속성 붙여넣기 (${ne.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),P.push({type:"separator"}),P.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(L.id)}),(po=ce.value)==null||po.open(ae,P)}function N({event:y,edge:L}){var ge,P;const ae=y;if(ae.preventDefault(),!i.editable.value)return;const ue=_(L.id);if(ue){(ge=ce.value)==null||ge.open(ae,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ue.noteRef,ue.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ue.noteRef,ue.targetRef)}]);return}(P=ce.value)==null||P.open(ae,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(L.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(L.id)}])}function I(y){return y==="group"?"group":y==="note"?"note":"entity"}function v({node:y}){if(fe.value.length>1){i.selection.value=null;return}i.selection.value={kind:I(y.type),id:y.id}}function E({nodes:y}){y.length>1&&(i.selection.value=null)}function C({edge:y}){const L=_(y.id);i.selection.value=L?{kind:"note",id:L.noteRef}:{kind:"association",id:y.id}}function D(y){const L=i.selection.value;return!!L&&L.kind!=="attribute"&&L.id===y.id}function B(y){var L,ae;return D(y)?y.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":y.type==="note"?"var(--em-note-soft)":y.type==="group"?Ic(tt((L=y.data)==null?void 0:L.style),!0)??"var(--em-mm-group)":Ic(tt((ae=y.data)==null?void 0:ae.style))??"var(--em-mm-entity)"}function oe(y){return D(y)?"var(--em-selection)":y.type==="note"?"var(--em-note-accent)":y.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ie(y,L){F(y,L,{zoom:K().zoom,duration:350})}n.watch(()=>i.focusRequest.value,y=>{if(!y)return;const L=h(y.id);if(!L)return;const ae=L.computedPosition??L.position,ue=L.dimensions??{width:0,height:0};ie(ae.x+ue.width/2,ae.y+ue.height/2)});function le({position:y}){ie(y.x,y.y)}function V({node:y}){i.selection.value={kind:I(y.type),id:y.id};const L=y.computedPosition??y.position,ae=y.dimensions??{width:0,height:0};ie(L.x+ae.width/2,L.y+ae.height/2)}function M({node:y}){ee({nodes:[y.id],duration:350,maxZoom:1.2,padding:.6})}return(y,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":a.value,"is-panning":r.value}])},[n.createVNode(n.unref(l0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!w.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(Et).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:U,onMoveEnd:Q,onConnect:q,onConnectStart:L[0]||(L[0]=ae=>a.value=!0),onConnectEnd:L[1]||(L[1]=ae=>a.value=!1),onNodeDrag:pe,onNodeDragStop:de,onNodeClick:v,onEdgeClick:C,onSelectionChange:E,onPaneClick:L[2]||(L[2]=ae=>n.unref(i).selection.value=null),onPaneContextMenu:ke,onNodeContextMenu:he,onEdgeContextMenu:N},{"node-group":n.withCtx(ae=>[n.createVNode(Lc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"node-entity":n.withCtx(ae=>[n.createVNode(Oc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"node-note":n.withCtx(ae=>[n.createVNode(Pc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"edge-association":n.withCtx(ae=>[n.createVNode(Qc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"edge-note-connection":n.withCtx(ae=>[n.createVNode(RN,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(b_),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(G_),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref($N),{key:1,pannable:"",width:224,height:160,"node-color":B,"node-stroke-color":oe,"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:le,onNodeClick:V,onNodeDblclick:M})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(UN,{ref_key:"menuRef",ref:ce},null,512)],2))}}),[["__scopeId","data-v-8123eaa4"]]),KN={class:"em-explorer"},XN={class:"em-explorer__rows"},qN=["data-key","onClick","onDblclick"],ZN=["onClick"],jN=["title"],JN={class:"em-key-slot"},QN={class:"em-key-slot"},ek={class:"em-explorer__label"},Zd=Ae(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=te.useModal(),a=n.computed(()=>{var w;const b=i.resolved.value,$=i.displayMode.value,h=R=>{var x,G,H;return go($,R.name,(G=(x=R.table)==null?void 0:x.logicalName)==null?void 0:G.ko,(H=R.table)==null?void 0:H.physicalName)},S=$==="PHYSICAL"||$==="LOGICAL_PHYSICAL",X=R=>{const x=R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0;return{icon:R.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:R.identifier,fk:x&&S}}},W=R=>R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0,J=$==="PHYSICAL"||$==="LOGICAL_PHYSICAL",T=R=>{if(R.attrType!=="EMBED_PREDEF")return R.dbAttrs;const x=i.embeddableCatalog.value.find(G=>G.type===R.type);return x?R.dbAttrs.map((G,H)=>{const Z=x.fields[H];return Z?{...G,physicalName:G.physicalName||Z.physicalName,logicalName:G.logicalName??Z.logicalName,dataType:G.dataType||Z.dataType,length:G.length??Z.length}:G}):R.dbAttrs},ee=(R,x)=>{var A,U,Q;const G={entityId:x,attrId:R.modelId};if(W(R)){const me=Fi($,R);return{key:`attr:${R.modelId}`,label:R.name+(me?` : ${me}`:""),icon:"table",attrRef:G,focusId:x,children:J?T(R).map(pe=>{var de;return{key:`attr:${R.modelId}:col:${pe.modelId}`,label:go($,pe.physicalName,(de=pe.logicalName)==null?void 0:de.ko,pe.physicalName)+(pe.dataType?` : ${pe.dataType}`:""),icon:"field",attrRef:G,focusId:x,children:[]}}):[]}}const H=Va(R,i.state.logical.associations),Z=Fi($,R,H);return{key:`attr:${R.modelId}`,label:go($,R.name,(U=(A=R.dbAttrs[0])==null?void 0:A.logicalName)==null?void 0:U.ko,(Q=R.dbAttrs[0])==null?void 0:Q.physicalName)+(Z?` : ${Z}`:""),...X(R),attrRef:G,focusId:x,children:[]}},F=R=>{const x=R.entity,G=[...x.attributes].sort((H,Z)=>H.order-Z.order);return{key:`entity:${x.modelId}`,label:h(x),icon:"table",selectKind:"entity",selectId:x.modelId,focusId:x.modelId,children:G.map(H=>ee(H,x.modelId))}},K=new Map,O=[];for(const R of b.entities)if(R.groupRef){const x=K.get(R.groupRef)??[];x.push(R),K.set(R.groupRef,x)}else O.push(R);const fe=[];for(const R of b.groups){const x=R.group;fe.push({key:`group:${x.modelId}`,label:((w=x.name)==null?void 0:w.ko)||x.packageName||"(그룹)",icon:"folder",focusId:x.modelId,children:(K.get(x.modelId)??[]).map(F)})}for(const R of O)fe.push(F(R));if(b.associations.length){const R=new Map(b.entities.map(x=>[x.entity.modelId,h(x.entity)]));fe.push({key:"section:associations",label:`관계 (${b.associations.length})`,icon:"arrow-lr",children:b.associations.map(x=>{const G=x.association,H=R.get(G.end1.entityRef)??G.end1.entityRef,Z=R.get(G.end2.entityRef)??G.end2.entityRef;return{key:`assoc:${G.modelId}`,label:`${H} — ${Z}`,icon:"arrow-lr",selectKind:"association",selectId:G.modelId,children:[]}})})}return b.notes.length&&fe.push({key:"section:notes",label:`노트 (${b.notes.length})`,icon:"note",children:b.notes.map(({note:R})=>{var x;return{key:`note:${R.modelId}`,label:((x=R.memo.split(`
41
- `)[0])==null?void 0:x.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:R.modelId,focusId:R.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:fe}});function r(b){return b?b.pk&&b.fk?"PFK (식별 외래키)":b.pk?"PK (기본키)":b.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(b){const $=new Set(s.value);$.has(b)?$.delete(b):$.add(b),s.value=$}const d=n.computed(()=>{const b=[],$=(h,S)=>{if(b.push({node:h,depth:S}),!s.value.has(h.key))for(const X of h.children)$(X,S+1)};return $(a.value,0),b}),u=n.computed(()=>{const b=[],$=h=>{if(h.children.length){h.key!=="root"&&b.push(h.key);for(const S of h.children)$(S)}};return $(a.value),b}),f=n.computed(()=>!u.value.some(b=>s.value.has(b)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(b){const $=i.selection.value;return b.attrRef?($==null?void 0:$.kind)==="attribute"&&$.entityId===b.attrRef.entityId&&$.ids.includes(b.attrRef.attrId):!!$&&$.kind!=="attribute"&&!!b.selectId&&b.selectKind===$.kind&&b.selectId===$.id}function g(b){const $=i.selection.value;return b.selectKind==="entity"&&($==null?void 0:$.kind)==="attribute"&&$.entityId===b.selectId}function _(b,$){if(b.attrRef){const h=$.shiftKey?"range":$.metaKey||$.ctrlKey?"toggle":"replace";i.selectAttribute(b.attrRef.entityId,b.attrRef.attrId,h)}else b.selectKind&&b.selectId&&(i.selection.value={kind:b.selectKind,id:b.selectId});b.focusId&&i.requestFocus(b.focusId)}function k(b){b.selectKind==="entity"&&b.selectId&&si(l,i,b.selectId)}return(b,$)=>(n.openBlock(),n.createElementBlock("section",KN,[n.createElementVNode("div",XN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:h,depth:S})=>(n.openBlock(),n.createElementBlock("div",{key:h.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(h),"is-focus-parent":g(h),"is-selectable":!!h.selectKind||!!h.attrRef||!!h.focusId}]),"data-key":h.key,style:n.normalizeStyle({paddingLeft:4+S*14+"px"}),onClick:X=>_(h,X),onDblclick:X=>k(h)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!h.children.length,"is-open":!s.value.has(h.key)}]),onClick:n.withModifiers(X=>h.children.length&&c(h.key),["stop"])},[h.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,ZN),h.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(h.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",JN,[h.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):h.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:h.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",QN,[h.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,jN)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:h.icon,size:15},null,8,["name"])),n.createElementVNode("span",ek,n.toDisplayString(h.label),1)],46,qN))),128))])]))}}),[["__scopeId","data-v-eba61575"]]),tk={class:"em-text-preview"},nk={class:"em-text-preview__pre"},ok={class:"em-text-preview__actions"},ik=Ae(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=te.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),te.showNotification("클립보드에 복사되었습니다.","info")}catch{te.showNotification("복사에 실패했습니다.","error")}}return(l,a)=>(n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",tk,[n.createElementVNode("pre",nk,n.toDisplayString(t.text),1),n.createElementVNode("div",ok,[n.createVNode(n.unref(te.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:a[0]||(a[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),lk={class:"em-toolbar"},ak={class:"em-toolbar__mode"},jd=Ae(n.defineComponent({__name:"EditorToolbar",props:{controller:{}},emits:["exportSvg"],setup(e,{emit:t}){const i=e.controller,l=t,a=te.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){const m=i.state.logical.entities.length;i.addEntity("NewEntity",{x:80+m*40,y:80+m*30})}function d(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const u=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(g=>g.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function p(){a.openModal({component:ik,bind:{text:ka(i.state.logical)}})}return(m,g)=>(n.openBlock(),n.createElementBlock("div",lk,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:g[0]||(g[0]=_=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:g[1]||(g[1]=_=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),g[8]||(g[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"엔티티 추가",disabled:!n.unref(i).editable.value,onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:g[2]||(g[2]=_=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),g[9]||(g[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",ak,[g[7]||(g[7]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[3]||(g[3]=_=>s.value=_),items:r,"value-provider":_=>_.v,"label-provider":_=>_.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:d},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:g[4]||(g[4]=_=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:g[5]||(g[5]=_=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:u.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:u.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:g[6]||(g[6]=_=>l("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1})]))}}),[["__scopeId","data-v-72d12e28"]]),rk=Ae(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,l)=>(n.openBlock(),n.createBlock(n.unref(te.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:l[0]||(l[0]=a=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),sk=["disabled"],ck={class:"em-panel__sub"},dk=["data-attr-block"],uk={class:"em-attr__row"},fk={key:0,class:"em-attr__row"},mk={class:"em-attr__row"},pk={class:"em-attr__row"},hk={class:"em-attr__flags"},gk={class:"em-attr__pii"},yk={class:"em-attr__pii"},bk={class:"em-attr__pii"},_k={key:0,class:"em-attr__pii em-attr__codetop"},vk={class:"em-multilang"},wk={key:2,class:"em-embed-cols"},Ek={class:"em-embed-col__label"},Nk={class:"em-attr__row"},kk={class:"em-attr__row"},xk={key:0,class:"em-embed-upd"},$k={class:"em-embed-upd"},Ik={class:"em-embed-upd"},Sk={class:"em-swatch__row em-attr__swatch"},Ck=["onClick"],Rk=["title","onClick"],Vk={key:0,class:"em-attr__swatch-hint"},Mi="__OWN__",Ak=Ae(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(P=>P.modelId===t.entityId)??null),l=n.computed(()=>i.value?o.state.layout.entityLayouts.find(P=>P.entityRef===i.value.modelId)??null:null),a=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>{var P;return((P=o.selectedAttr.value)==null?void 0:P.attrId)??null}),s=n.computed(()=>new Set(o.selectedAttrIds.value)),c=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.attributes.filter(Y=>Y.attrType!=="DIVIDER"))??[]}),d=n.ref(null);n.watch(r,async P=>{var Y,z;P&&(await n.nextTick(),(z=(Y=d.value)==null?void 0:Y.querySelector(`[data-attr-block="${P}"]`))==null||z.scrollIntoView({block:"nearest",behavior:"smooth"}))});const u=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function f(P){return P==="none"?"(없음)":P}const p=P=>P;function m(P){var Y,z;return tt((z=(Y=l.value)==null?void 0:Y.attributeStyles)==null?void 0:z[P.modelId])}function g(P){return s.value.size>1&&s.value.has(P.modelId)}function _(P,Y){if(!i.value)return;const z=g(P)?o.selectedAttrIds.value:[P.modelId];o.setAttributeSwatches(i.value.modelId,z,Y)}function k(P,Y){i.value&&o.updateAttribute(i.value.modelId,P.modelId,Y)}function b(P){return!!P.transient}const $=P=>P.value,h=P=>P.label;function S(P,Y){if(!Y)return;const z=K.value.find(j=>j.type===Y);if(z){const j=P.dbAttrs[0]??{modelId:P.modelId+".c",physicalName:P.name,dataType:"VARCHAR"};k(P,{type:Y,customType:void 0,dbAttrs:[{...j,dataType:z.dataType,length:z.length,scale:z.scale}]});return}k(P,Y===Pt?{type:Y}:{type:Y,customType:void 0})}function X(P,Y){k(P,{customType:Y.trim()===""?void 0:Y})}function W(P,Y){const z=P.dbAttrs[0]??{modelId:P.modelId+".c",physicalName:P.name,dataType:"VARCHAR"};k(P,{dbAttrs:[{...z,...Y}]})}function J(P,Y,z){var j;W(P,{logicalName:{...(j=P.dbAttrs[0])==null?void 0:j.logicalName,[Y]:z}})}function T(P,Y){k(P,{description:Object.keys(Y).length?Y:void 0})}function ee(P){return P.personalInfoAttributeType??"none"}function F(P,Y){k(P,{personalInfoAttributeType:Y==="none"?void 0:Y})}const K=n.computed(()=>o.predefinedCustomTypeCatalog.value),O=n.computed(()=>o.embeddableCatalog.value),fe=n.ref(void 0);function w(P){var Y,z;return((Y=P.label)==null?void 0:Y.ko)??((z=P.label)==null?void 0:z.en)??P.type}function R(P){!P||!i.value||(o.addPredefinedEmbed(i.value.modelId,P),fe.value=void 0)}const x=n.computed(()=>o.groupCodeCatalog.value);function G(P){var Y;return((Y=x.value.find(z=>z.groupCode===P.groupCode))==null?void 0:Y.codes)??[]}function H(P){return["none",...G(P)]}function Z(P){return P==="none"?"none":P.code}function A(P){var z,j;if(P==="none")return"(없음)";const Y=((z=P.label)==null?void 0:z.ko)??((j=P.label)==null?void 0:j.en);return Y?`${P.code} (${Y})`:P.code}function U(P,Y){i.value&&o.setAttributeGroupCode(i.value.modelId,P.modelId,Y)}function Q(P,Y){k(P,{defaultValue:Y==="none"?void 0:Y})}function me(P,Y){k(P,{defaultValue:Y.trim()===""?void 0:Y})}function pe(P){return P.attrType.startsWith("EMBED")&&P.dbAttrs.length>0}function de(P,Y,z){const j=P.dbAttrs.map((ne,se)=>{if(se!==Y)return ne;const be={...ne,...z};for(const re of Object.keys(z))z[re]===void 0&&delete be[re];return be});i.value&&o.setEmbedColumns(i.value.modelId,P.modelId,j)}function q(P,Y,z,j){var ne;de(P,Y,{logicalName:{...(ne=P.dbAttrs[Y])==null?void 0:ne.logicalName,[z]:j}})}function ce(P,Y){var ne,se,be;if(P.attrType==="EMBED_PREDEF"){const re=(ne=o.embeddableCatalog.value.find(we=>we.type===P.type))==null?void 0:ne.fields[Y];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const z=(se=P.embedded)==null?void 0:se.embeddableRef;if(!z)return;const j=(be=o.state.logical.entities.find(re=>re.modelId===z))==null?void 0:be.attributes.flatMap(re=>re.dbAttrs)[Y];return j?{physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,logicalName:j.logicalName}:void 0}function Ee(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.dataType)||((j=P.dbAttrs[Y])==null?void 0:j.dataType)||""}function $e(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.length)??((j=P.dbAttrs[Y])==null?void 0:j.length)}function ke(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.scale)??((j=P.dbAttrs[Y])==null?void 0:j.scale)}const he=["inherit","true","false"];function N(P){return P==="inherit"?"기본(따름)":P}function I(P){return(P==null?void 0:P.updatable)===void 0?"inherit":P.updatable?"true":"false"}function v(P,Y,z){de(P,Y,{updatable:z==="inherit"?void 0:z==="true"})}function E(P,Y){W(P,{updatable:Y==="inherit"?void 0:Y==="true"})}const C=["inherit","true","false"];function D(P){return P==="inherit"?"기본(따름)":P}function B(P){return(P==null?void 0:P.insertable)===void 0?"inherit":P.insertable?"true":"false"}function oe(P,Y,z){de(P,Y,{insertable:z==="inherit"?void 0:z==="true"})}function ie(P,Y){W(P,{insertable:Y==="inherit"?void 0:Y==="true"})}const le=n.computed(()=>{var P;return $n(((P=i.value)==null?void 0:P.attributes.flatMap(Y=>Y.dbAttrs))??[])}),V=n.computed(()=>{var P;return(((P=i.value)==null?void 0:P.attributes)??[]).filter(Y=>Y.attrType==="NORMAL"&&Y.dbAttrs.length===1&&Y.dbAttrs[0]).map(Y=>({modelId:Y.dbAttrs[0].modelId,label:Y.dbAttrs[0].physicalName||Y.name}))});function M(){return[Mi,...V.value.map(P=>P.modelId)]}function y(P){if(P===Mi)return"전용 컬럼(OWN)";const Y=V.value.find(z=>z.modelId===P);return Y?`↗ ${Y.label} (공유)`:P}function L(P){return(P==null?void 0:P.sharedColumnRef)??Mi}function ae(P,Y,z){de(P,Y,{sharedColumnRef:z===Mi?void 0:z})}function ue(P){return(P==null?void 0:P.sharedColumnRef)!=null}function ge(P){var Y;return((Y=bo(P,le.value))==null?void 0:Y.physicalName)??""}return(P,Y)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,ref_key:"sectionEl",ref:d,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",ck,[n.createTextVNode("속성 ("+n.toDisplayString(c.value.length)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:Y[0]||(Y[0]=z=>n.unref(o).addAttribute(i.value.modelId))}),O.value.length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":fe.value,items:O.value,"value-provider":z=>z.type,"label-provider":w,"onUpdate:modelValue":R},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,z=>{var j,ne,se,be,re,we,Ie,Re,Ze,Ot,Lt;return n.openBlock(),n.createElementBlock("div",{key:z.modelId,class:n.normalizeClass(["em-attr",{"is-focused":s.value.has(z.modelId)}]),"data-attr-block":z.modelId},[n.createElementVNode("div",uk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-name-${z.modelId}`,width:"100%",placeholder:"이름","model-value":z.name,"onUpdate:modelValue":ye=>k(z,{name:ye})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{name:`attr-type-${z.modelId}`,width:"84px",placeholder:"타입",disabled:z.attrType.startsWith("EMBED")||!!z.groupCode,items:n.unref(Ra)(z.type,K.value),"value-provider":$,"label-provider":h,"model-value":z.type,"onUpdate:modelValue":ye=>S(z,ye)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,z.modelId)},null,8,["onClick"])]),z.type===n.unref(Pt)?(n.openBlock(),n.createElementBlock("div",fk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${z.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":z.customType??"","onUpdate:modelValue":ye=>X(z,ye)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),pe(z)?(n.openBlock(),n.createElementBlock("div",wk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.dbAttrs,(ye,Oe)=>{var He,co,uo,fo,mo,po,Te;return n.openBlock(),n.createElementBlock("div",{key:ye.modelId,class:"em-embed-col"},[n.createElementVNode("span",Ek,n.toDisplayString(((He=ce(z,Oe))==null?void 0:He.name)??((co=ce(z,Oe))==null?void 0:co.physicalName)??`컬럼 ${Oe+1}`),1),n.createElementVNode("div",Nk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`embed-col-${ye.modelId}`,width:"100%",disabled:ue(ye),placeholder:((uo=ce(z,Oe))==null?void 0:uo.physicalName)??"컬럼","model-value":ue(ye)?ge(ye):ye.physicalName,"onUpdate:modelValue":De=>de(z,Oe,{physicalName:De})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSTextInput),{name:`embed-dtype-${ye.modelId}`,width:"84px",disabled:"","model-value":Ee(z,Oe)},null,8,["name","model-value"]),n.createVNode(n.unref(te.BSNumberInput),{name:`embed-len-${ye.modelId}`,width:"48px",disabled:"","model-value":$e(z,Oe)},null,8,["name","model-value"]),n.createVNode(n.unref(te.BSNumberInput),{name:`embed-scale-${ye.modelId}`,width:"48px",disabled:"","model-value":ke(z,Oe)},null,8,["name","model-value"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":ye.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",kk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`embed-logical-${ye.modelId}`,width:"100%",placeholder:((mo=(fo=ce(z,Oe))==null?void 0:fo.logicalName)==null?void 0:mo.ko)??"논리명","model-value":((po=ye.logicalName)==null?void 0:po.ko)??"","onUpdate:modelValue":De=>q(z,Oe,"ko",De)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Te=ce(z,Oe))!=null&&Te.shareable?(n.openBlock(),n.createElementBlock("label",xk,[Y[7]||(Y[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px","model-value":L(ye),items:M(),"value-provider":p,"label-provider":y,"onUpdate:modelValue":De=>De&&ae(z,Oe,De)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",$k,[Y[8]||(Y[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px",disabled:ue(ye),"model-value":ue(ye)?"false":B(ye),items:C,"value-provider":p,"label-provider":D,"onUpdate:modelValue":De=>De&&oe(z,Oe,De)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Ik,[Y[9]||(Y[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px",disabled:ue(ye),"model-value":ue(ye)?"false":I(ye),items:he,"value-provider":p,"label-provider":N,"onUpdate:modelValue":De=>De&&v(z,Oe,De)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",mk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-logical-${z.modelId}`,width:"100%",placeholder:"논리명","model-value":((ne=(j=z.dbAttrs[0])==null?void 0:j.logicalName)==null?void 0:ne.ko)??"","onUpdate:modelValue":ye=>J(z,"ko",ye)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",pk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-col-${z.modelId}`,width:"100%",placeholder:"컬럼",disabled:b(z),"model-value":((se=z.dbAttrs[0])==null?void 0:se.physicalName)??"","onUpdate:modelValue":ye=>W(z,{physicalName:ye})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{name:`attr-dtype-${z.modelId}`,width:"84px",placeholder:"dataType",disabled:b(z),items:n.unref(Ia)(((be=z.dbAttrs[0])==null?void 0:be.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":p,"label-provider":n.unref(Hi),"model-value":((re=z.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ye=>ye&&W(z,{dataType:ye})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSNumberInput),{name:`attr-len-${z.modelId}`,width:"48px",placeholder:"len",disabled:b(z),"model-value":(we=z.dbAttrs[0])==null?void 0:we.length,"onUpdate:modelValue":ye=>W(z,{length:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSNumberInput),{name:`attr-scale-${z.modelId}`,width:"48px",placeholder:"scale",disabled:b(z),"model-value":(Ie=z.dbAttrs[0])==null?void 0:Ie.scale,"onUpdate:modelValue":ye=>W(z,{scale:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":(Re=z.dbAttrs[0])==null?void 0:Re.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",hk,[n.createVNode(n.unref(te.BSCheckbox),{name:`attr-pk-${z.modelId}`,label:"Primary Key","model-value":z.identifier,disabled:a.value||b(z),"onUpdate:modelValue":ye=>k(z,{identifier:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-nn-${z.modelId}`,label:"Not Null","model-value":z.notNull,disabled:b(z),"onUpdate:modelValue":ye=>k(z,{notNull:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-uq-${z.modelId}`,label:"Unique","model-value":!!((Ze=z.dbAttrs[0])!=null&&Ze.unique),disabled:b(z),"onUpdate:modelValue":ye=>W(z,{unique:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-ai-${z.modelId}`,label:"Auto Increment","model-value":!!((Ot=z.dbAttrs[0])!=null&&Ot.autoIncrement),disabled:b(z)||!z.identifier,"onUpdate:modelValue":ye=>W(z,{autoIncrement:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-tr-${z.modelId}`,label:"@Transient","model-value":!!z.transient,disabled:z.identifier,"onUpdate:modelValue":ye=>k(z,{transient:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-mv-${z.modelId}`,label:"Multi-Value (Set)","model-value":!!((Lt=z.dbAttrs[0])!=null&&Lt.multiValue),disabled:b(z),"onUpdate:modelValue":ye=>W(z,{multiValue:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",gk,[Y[1]||(Y[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:b(z),"model-value":B(z.dbAttrs[0]),items:C,"value-provider":p,"label-provider":D,"onUpdate:modelValue":ye=>ye&&ie(z,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",yk,[Y[2]||(Y[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:b(z),"model-value":I(z.dbAttrs[0]),items:he,"value-provider":p,"label-provider":N,"onUpdate:modelValue":ye=>ye&&E(z,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",bk,[Y[3]||(Y[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":ee(z),items:u,"value-provider":p,"label-provider":f,"onUpdate:modelValue":ye=>ye&&F(z,ye)},null,8,["model-value","onUpdate:modelValue"])]),x.value.length?(n.openBlock(),n.createElementBlock("label",_k,[Y[4]||(Y[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Rc,{"model-value":z.groupCode,items:x.value,"onUpdate:modelValue":ye=>U(z,ye)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!x.value.length}])},[Y[5]||(Y[5]=n.createElementVNode("span",null,"기본값",-1)),G(z).length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":z.defaultValue??"none",items:H(z),"value-provider":Z,"label-provider":A,"onUpdate:modelValue":ye=>ye&&Q(z,ye)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:1,name:`attr-default-${z.modelId}`,width:"100%",placeholder:"기본값","model-value":z.defaultValue??"","onUpdate:modelValue":ye=>me(z,ye)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",vk,[Y[6]||(Y[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:`attr-desc-${z.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":z.description,"onUpdate:modelValue":ye=>T(z,ye)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",Sk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":m(z)===null}]),title:"없음",onClick:ye=>_(z,null)},"∅",10,Ck),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),ye=>(n.openBlock(),n.createElementBlock("button",{key:ye,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":m(z)===ye}]),style:n.normalizeStyle({background:n.unref(ai)(ye)}),title:n.unref(li)(ye),onClick:Oe=>_(z,ye)},null,14,Rk))),128)),g(z)?(n.openBlock(),n.createElementBlock("span",Vk,"선택 "+n.toDisplayString(s.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,dk)}),128))],8,sk)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4383b724"]]),Tk=["disabled"],Mk={class:"em-panel__sub"},Bk={class:"em-attr__row"},Dk={class:"em-field em-idx-params"},Ok=["value","onChange"],Lk=Ae(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(f=>f.modelId===t.entityId)??null);function l(){var p;if(!i.value)return;const f=i.value.attributes[0];o.addIndex(i.value.modelId,{modelId:Se(),name:`idx_${(((p=i.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:f?[{columnRef:f.modelId,descending:!1}]:[]})}function a(f,p){i.value&&o.updateIndex(i.value.modelId,f,p)}function r(f){var m;const p=(m=i.value)==null?void 0:m.attributes[0];p&&a(f.modelId,{columns:[...f.columns,{columnRef:p.modelId,descending:!1}]})}function s(f,p,m){a(f.modelId,{columns:f.columns.map((g,_)=>_===p?{...g,columnRef:m}:g)})}function c(f,p,m){a(f.modelId,{columns:f.columns.map((g,_)=>_===p?{...g,descending:m}:g)})}function d(f,p){a(f.modelId,{columns:f.columns.filter((m,g)=>g!==p)})}function u(f,p){a(f.modelId,{parameters:p.trim()===""?void 0:p})}return(f,p)=>{var m;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Mk,[n.createTextVNode("인덱스 ("+n.toDisplayString(((m=i.value.indexes)==null?void 0:m.length)??0)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:l})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.indexes??[],g=>(n.openBlock(),n.createElementBlock("div",{key:g.modelId,class:"em-attr"},[n.createElementVNode("div",Bk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`idx-name-${g.modelId}`,width:"100%",placeholder:"인덱스명","model-value":g.name,"onUpdate:modelValue":_=>a(g.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`idx-uq-${g.modelId}`,class:"em-check",label:"UQ","model-value":g.unique,"onUpdate:modelValue":_=>a(g.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(o).removeIndex(i.value.modelId,g.modelId)},null,8,["onClick"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":g.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.columns,(_,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(te.BSSelect),{class:"grow","model-value":_.columnRef,items:i.value.attributes,"value-provider":b=>b.modelId,"label-provider":b=>b.name,"onUpdate:modelValue":b=>b&&s(g,k,b)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`idx-${g.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":b=>c(g,k,b)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"−",onClick:b=>d(g,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"컬럼",onClick:_=>r(g)},null,8,["onClick"]),n.createElementVNode("label",Dk,[p[0]||(p[0]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:g.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>u(g,_.target.value)},null,40,Ok)])]))),128))],8,Tk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-63401907"]]),Pk=["disabled"],zk={class:"em-panel__sub"},Uk={class:"em-attr__row"},Hk={class:"em-attr__row"},Fk={class:"em-multilang"},Gk={class:"em-attr__pii"},Yk={class:"em-swatch__row em-attr__swatch"},Wk=["onClick"],Kk=["title","onClick"],Xk=Ae(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModal(),l=n.computed(()=>o.state.logical.entities.find(b=>b.modelId===t.entityId)??null),a=n.computed(()=>l.value?o.state.layout.entityLayouts.find(b=>b.entityRef===l.value.modelId)??null:null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],s=["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 c(b){return b==="none"?"(없음)":b}const d=b=>b;function u(b,$){l.value&&o.updateOperation(l.value.modelId,b.modelId,$)}function f(b,$){u(b,{description:Object.keys($).length?$:void 0})}function p(b){return b.personalInfoAttributeType??"none"}function m(b,$){u(b,{personalInfoAttributeType:$==="none"?void 0:$})}function g(b){var $,h;return tt((h=($=a.value)==null?void 0:$.operationStyles)==null?void 0:h[b.modelId])}function _(b,$){l.value&&o.setOperationSwatch(l.value.modelId,b.modelId,$)}function k(b){i.openModal({component:Vc,bind:{operationName:b.name,sourceCode:b.sourceCode??"",onSave:$=>u(b,{sourceCode:$})}})}return(b,$)=>{var h;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",zk,[n.createTextVNode("오퍼레이션 ("+n.toDisplayString(((h=l.value.operations)==null?void 0:h.length)??0)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:$[0]||($[0]=S=>n.unref(o).addOperation(l.value.modelId))})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value.operations??[],S=>(n.openBlock(),n.createElementBlock("div",{key:S.modelId,class:"em-attr"},[n.createElementVNode("div",Uk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":X=>u(S,{name:X})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":X=>X&&u(S,{visibility:X})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Hk,[n.createVNode(n.unref(te.BSButton),{variant:"text",caption:S.sourceCode?"본문 편집 ●":"본문 편집",onClick:X=>k(S)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Fk,[$[1]||($[1]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:`op-desc-${S.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":X=>f(S,X)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Gk,[$[2]||($[2]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":p(S),items:s,"value-provider":d,"label-provider":c,"onUpdate:modelValue":X=>X&&m(S,X)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Yk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(S)===null}]),title:"없음",onClick:X=>_(S,null)},"∅",10,Wk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),X=>(n.openBlock(),n.createElementBlock("button",{key:X,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(S)===X}]),style:n.normalizeStyle({background:n.unref(ai)(X)}),title:n.unref(li)(X),onClick:W=>_(S,X)},null,14,Kk))),128))])]))),128))],8,Pk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-cd38ffcd"]]),qk={class:"em-panel"},Zk={class:"em-panel__head"},jk={class:"em-panel__context"},Jk=["disabled"],Qk={key:0,class:"em-panel__note"},ex={key:1,class:"em-panel__note"},tx={key:2,class:"em-jpa"},nx={class:"em-field"},ox={class:"em-field"},ix={key:0,class:"em-field"},lx={class:"em-panel__sub"},ax={class:"em-field"},rx={class:"em-jpa"},sx={key:0,class:"em-panel__note"},cx={class:"em-jpa"},dx={class:"em-field"},ux={key:0,class:"em-panel__note"},fx={class:"em-field"},mx={class:"em-multilang"},px={class:"em-field"},hx=["value"],gx={class:"em-field"},yx={class:"em-panel__note"},bx={key:3,class:"em-field"},_x=["value"],Jd=Ae(n.defineComponent({__name:"PropertyPanel",props:{controller:{}},setup(e){const o=e.controller,i=n.computed(()=>o.selection.value),l=n.computed(()=>o.inspectedEntityId.value),a=n.computed(()=>{const A=l.value;return A?o.state.logical.entities.find(U=>U.modelId===A)??null:null}),r=n.computed(()=>{var A;return((A=o.selectedAttr.value)==null?void 0:A.attrId)??null}),s=n.computed(()=>new Set(o.selectedAttrIds.value)),c=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="association"?o.state.logical.associations.find(U=>U.modelId===A.id)??null:null}),d=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="group"?o.state.logical.groups.find(U=>U.modelId===A.id)??null:null}),u=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="note"?o.state.layout.notes.find(U=>U.modelId===A.id)??null:null}),f=n.computed(()=>{var U,Q;const A=(U=d.value)==null?void 0:U.name;return(A==null?void 0:A.ko)||(A==null?void 0:A.en)||(A==null?void 0:A.ja)||(A==null?void 0:A.zh)||((Q=d.value)==null?void 0:Q.packageName)||"그룹"}),p=n.computed(()=>{if(a.value){const A=s.value.size;if(A>1)return`엔티티 · ${a.value.name} › 속성 · ${A}개`;if(r.value){const U=a.value.attributes.find(Q=>Q.modelId===r.value);return(U==null?void 0:U.attrType)==="DIVIDER"?`엔티티 · ${a.value.name} › 구분선`:`엔티티 · ${a.value.name} › 속성 · ${(U==null?void 0:U.name)??""}`}return`엔티티 · ${a.value.name}`}if(c.value){const A=U=>{var Q;return((Q=o.state.logical.entities.find(me=>me.modelId===U))==null?void 0:Q.name)??U};return`관계 · ${A(c.value.end1.entityRef)} — ${A(c.value.end2.entityRef)}`}return d.value?`그룹 · ${f.value}`:u.value?"노트":"선택된 항목 없음"}),m=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],g=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],_=["LIST","SET"],k=["inherit","LAZY","EAGER"],b=A=>A;function $(A){return A==="inherit"?"기본(따름)":A}const h=n.computed(()=>!!c.value&&c.value.end1.entityRef===c.value.end2.entityRef);function S(A,U){c.value&&o.updateAssociationEnd(c.value.modelId,A,U)}function X(A){c.value&&!h.value&&o.setAssociationIdentifying(c.value.modelId,A)}function W(A){var U,Q,me;return!!((me=(Q=(U=c.value)==null?void 0:U[A].jpa)==null?void 0:Q.cascadeTypes)!=null&&me.includes("ALL"))}function J(A,U,Q){var de,q;const me=(de=c.value)==null?void 0:de[A];if(U==="ALL"&&Q){S(A,{jpa:{...me==null?void 0:me.jpa,cascadeTypes:["ALL"]}});return}const pe=new Set(((q=me==null?void 0:me.jpa)==null?void 0:q.cascadeTypes)??[]);Q?pe.add(U):pe.delete(U),S(A,{jpa:{...me==null?void 0:me.jpa,cascadeTypes:[...pe]}})}function T(A,U){var me;const Q=(me=c.value)==null?void 0:me[A];S(A,{jpa:{...Q==null?void 0:Q.jpa,...U}})}function ee(A){var U,Q;return((Q=(U=c.value)==null?void 0:U[A].jpa)==null?void 0:Q.fetchType)??"inherit"}function F(A,U){T(A,{fetchType:U==="inherit"?void 0:U})}function K(A){var Q;const U=(Q=c.value)==null?void 0:Q[A==="end1"?"end2":"end1"];return(U==null?void 0:U.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(U==null?void 0:U.multiplicity)==="ONE_OR_MORE_INSTANCES"}const O=n.computed(()=>{const A=c.value;if(!A)return null;for(const U of o.state.logical.entities){const Q=U.attributes.find(de=>{var q;return((q=de.embedded)==null?void 0:q.associationRef)===A.modelId&&de.attrType==="EMBED_OWN"});if(!Q)continue;const me=A.end2.entityRef===Q.embedded.embeddableRef?"end2":"end1",pe=A[me].jpa;return{which:me,isCollection:A[me].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(pe==null?void 0:pe.collectionType)??"LIST",collectionTable:(pe==null?void 0:pe.collectionTable)??"",orderColumn:(pe==null?void 0:pe.orderColumn)??""}}return null});function fe(A){c.value&&o.setEmbedCollectionMode(c.value.modelId,A?"COLLECTION":"SINGLE")}function w(A){const U=O.value;U&&T(U.which,A==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function R(A){const U=O.value;U&&T(U.which,{collectionTable:A.trim()||void 0})}function x(A){const U=O.value;U&&T(U.which,{orderColumn:A.trim()||void 0})}function G(A){d.value&&o.updateGroup(d.value.modelId,A)}function H(A,U){var Q;G({name:{...(Q=d.value)==null?void 0:Q.name,[A]:U}})}function Z(A){u.value&&o.setNoteMemo(u.value.modelId,A)}return(A,U)=>(n.openBlock(),n.createElementBlock("aside",qk,[n.createElementVNode("header",Zk,[U[5]||(U[5]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("p",jk,n.toDisplayString(p.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body",disabled:!n.unref(o).editable.value},[a.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Sc,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Ak,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Lk,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Xk,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])],64)):n.createCommentVNode("",!0),c.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!c.value.identifying,disabled:h.value||!!O.value,"onUpdate:modelValue":X},null,8,["model-value","disabled"]),h.value?(n.openBlock(),n.createElementBlock("p",Qk,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):O.value?(n.openBlock(),n.createElementBlock("p",ex,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),O.value?(n.openBlock(),n.createElementBlock("fieldset",tx,[U[9]||(U[9]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(te.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":O.value.isCollection,"onUpdate:modelValue":fe},null,8,["model-value"]),O.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",nx,[U[6]||(U[6]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":O.value.collectionType,items:_,"value-provider":b,"label-provider":b,"onUpdate:modelValue":U[0]||(U[0]=Q=>Q&&w(Q))},null,8,["model-value"])]),n.createElementVNode("label",ox,[U[7]||(U[7]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":O.value.collectionTable,"onUpdate:modelValue":R},null,8,["model-value"])]),O.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",ix,[U[8]||(U[8]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":O.value.orderColumn,"onUpdate:modelValue":x},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),U[10]||(U[10]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],Q=>{var me,pe,de,q;return n.createElementVNode("div",{key:Q,class:"em-end"},[n.createElementVNode("h4",lx,n.toDisplayString(Q)+" → "+n.toDisplayString(c.value[Q].entityRef),1),n.createElementVNode("label",ax,[U[11]||(U[11]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":c.value[Q].multiplicity,items:m,"value-provider":b,"label-provider":b,disabled:((me=O.value)==null?void 0:me.which)===Q,"onUpdate:modelValue":ce=>S(Q,{multiplicity:ce})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-navigable`,class:"em-check",label:"navigable","model-value":c.value[Q].navigable,"onUpdate:modelValue":ce=>S(Q,{navigable:ce})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-composition`,class:"em-check",label:"composition","model-value":c.value[Q].composition,"onUpdate:modelValue":ce=>S(Q,{composition:ce})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",rx,[U[12]||(U[12]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(g,ce=>{var Ee,$e;return n.createVNode(n.unref(te.BSCheckbox),{key:ce,name:`${Q}-cascade-${ce}`,class:"em-check",label:ce,"model-value":!!(($e=(Ee=c.value[Q].jpa)==null?void 0:Ee.cascadeTypes)!=null&&$e.includes(ce)),disabled:ce!=="ALL"&&W(Q),"onUpdate:modelValue":ke=>J(Q,ce,ke)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),W(Q)?(n.openBlock(),n.createElementBlock("p",sx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",cx,[U[15]||(U[15]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",dx,[U[13]||(U[13]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":ee(Q),items:k,"value-provider":b,"label-provider":$,"onUpdate:modelValue":ce=>ce&&F(Q,ce)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((pe=c.value[Q].jpa)!=null&&pe.orphanRemoval),disabled:K(Q),"onUpdate:modelValue":ce=>T(Q,{orphanRemoval:ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),K(Q)&&((de=c.value[Q].jpa)!=null&&de.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",ux,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",fx,[U[14]||(U[14]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(te.BSTextInput),{name:`${Q}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((q=c.value[Q].jpa)==null?void 0:q.orderBy)??"","onUpdate:modelValue":ce=>T(Q,{orderBy:ce.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),d.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",mx,[U[16]||(U[16]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).languages.value,Q=>{var me;return n.openBlock(),n.createElementBlock("label",{key:Q,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(Q),1),n.createVNode(n.unref(te.BSTextInput),{name:`grp-name-${Q}`,width:"100%","model-value":((me=d.value.name)==null?void 0:me[Q])??"","onUpdate:modelValue":pe=>H(Q,pe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",px,[U[17]||(U[17]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:d.value.description??"",rows:"3",onChange:U[1]||(U[1]=Q=>G({description:Q.target.value}))},null,40,hx)]),n.createElementVNode("label",gx,[U[18]||(U[18]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":d.value.packageName??"","onUpdate:modelValue":U[2]||(U[2]=Q=>G({packageName:Q}))},null,8,["model-value"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":d.value.excludeDDLGeneration,"onUpdate:modelValue":U[3]||(U[3]=Q=>G({excludeDDLGeneration:Q}))},null,8,["model-value"]),n.createElementVNode("p",yx,"멤버 엔티티 "+n.toDisplayString(d.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),u.value?(n.openBlock(),n.createElementBlock("label",bx,[U[19]||(U[19]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:u.value.memo,rows:"6",onChange:U[4]||(U[4]=Q=>Z(Q.target.value))},null,40,_x)])):n.createCommentVNode("",!0)],8,Jk)]))}}),[["__scopeId","data-v-cca729a3"]]),vx={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function wx(e){const t=e.split("-")[1];return t?vx[t]??t:e}function Ex(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Nx=["title"],kx=["title","onClick"],xx={key:0,class:"em-validation__body"},$x={class:"em-validation__opt"},Ix={key:0,class:"em-validation__empty"},Sx={key:1,class:"em-validation__empty"},Cx={key:2,class:"em-validation__list"},Rx=["onClick"],Vx={class:"em-validation__item-msg"},Ax={key:0,class:"em-validation__item-entity"},Tx=["title"],Mx=Ae(n.defineComponent({__name:"ValidationPanel",props:{controller:{}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),l=n.computed(()=>{const _=new Map;for(const k of o.state.logical.entities)_.set(k.modelId,k.name);return _});function a(_){const k=Ex(_);if(!k)return null;const b=l.value.get(k);return b===void 0?null:b.trim()===""?"(이름 없음)":b}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const _={error:0,warning:0,info:0};for(const k of i.value)_[k.severity]++;return _}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,k)=>r[_.severity].order-r[k.severity].order)),u=n.computed(()=>d.value.map(_=>({issue:_,entityName:a(_),category:wx(_.ruleId)}))),f=n.ref(!1);function p(_){c.value[_]=!c.value[_]}function m(_){if(!f.value){f.value=!0;return}p(_)}function g(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,k)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value}])},[n.createElementVNode("header",{class:"em-validation__head",onClick:k[1]||(k[1]=b=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),k[3]||(k[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,Nx),n.createElementVNode("div",{class:"em-validation__counts",onClick:k[0]||(k[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:f.value?`${r[b].label} ${c.value[b]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:$=>m(b)},[n.createVNode(Ve,{name:r[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,kx)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",xx,[n.createElementVNode("label",$x,[n.createVNode(n.unref(te.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":k[2]||(k[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",Ix,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",Sx," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",Cx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:$,category:h},S)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${S}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:X=>g(b)},[n.createVNode(Ve,{name:r[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",Vx,[$?(n.openBlock(),n.createElementBlock("span",Ax,n.toDisplayString($),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(h),9,Tx)],10,Rx))),128))]))])):n.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-bc9e6f86"]]),Bx={class:"em-modeler"},Dx={class:"em-modeler__body"},Ox={class:"em-drawer__inner"},Lx={class:"em-drawer__head"},Px={class:"em-drawer__actions"},zx=["title"],Ux=Ae(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(null),i=n.ref(null);return(l,a)=>{var r,s,c;return n.openBlock(),n.createElementBlock("div",Bx,[n.createVNode(jd,{controller:e.controller,onExportSvg:a[0]||(a[0]=d=>{var u;return(u=o.value)==null?void 0:u.exportSvg()})},null,8,["controller"]),n.createElementVNode("div",Dx,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}])},[n.createElementVNode("div",Ox,[n.createElementVNode("header",Lx,[a[4]||(a[4]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",Px,[(r=i.value)!=null&&r.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(s=i.value)!=null&&s.allExpanded?"모두 접기":"모두 펼치기",onClick:a[1]||(a[1]=d=>{var u;return(u=i.value)==null?void 0:u.toggleAll()})},[n.createVNode(Ve,{name:(c=i.value)!=null&&c.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,zx)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:a[2]||(a[2]=d=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Zd,{ref_key:"explorer",ref:i,controller:e.controller},null,8,["controller"])])],2),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:a[3]||(a[3]=d=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value}])},[n.createVNode(qd,{ref_key:"canvas",ref:o,controller:e.controller},null,8,["controller"])],2),n.createVNode(Jd,{controller:e.controller},null,8,["controller"])]),n.createVNode(Mx,{controller:e.controller},null,8,["controller"])])}}}),[["__scopeId","data-v-ab7aefbd"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Vu,Ne.AssociationEdge=Qc,Ne.CommandStack=Wi,Ne.DiagramCanvas=qd,Ne.DiagramExplorer=Zd,Ne.EDITOR=Jt,Ne.EditModeToggle=rk,Ne.EditorToolbar=jd,Ne.EntityModeler=Ux,Ne.EntityNode=Oc,Ne.GroupNode=Lc,Ne.NoteNode=Pc,Ne.OpSyncAdapter=hr,Ne.PHYSICAL_NAME_MAX_LENGTH=Gi,Ne.PropertyPanel=Jd,Ne.RevCache=pr,Ne.SYMBOLIC_OP_KINDS=gr,Ne.SYMBOLIC_OP_SCHEMA=vr,Ne.anchoredEdgePoint=Pi,Ne.buildAgentBatch=Au,Ne.buildDiagramSvg=Kd,Ne.buildOrthogonalPath=Bi,Ne.buildSelfLoopPath=wa,Ne.buildStraightPath=Oi,Ne.commands=_u,Ne.computeAutoLayout=Ea,Ne.createEditorController=Eb,Ne.displayLabel=go,Ne.emptyState=Tc,Ne.entityModelToText=ka,Ne.exportDiagramSvg=Xd,Ne.fromPersisted=Yu,Ne.indexColumnsByModelId=$n,Ne.newId=Se,Ne.orthogonalMidpoints=Di,Ne.physicalNameWarning=_o,Ne.rectExitPoint=Li,Ne.renderDiagramSvg=$a,Ne.resolveDiagram=_a,Ne.resolveSharedColumn=bo,Ne.resolveSymbolicOps=Nu,Ne.segmentMidpoints=zi,Ne.sideDir=kn,Ne.toPersisted=af,Ne.toPersistedV2=rf,Ne.validateModel=Ta,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
39
+ v${-(q.value.height-2*e.maskBorderRadius)}
40
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(W=>{if(b.value){const oe=Wt(b.value),T=he=>{if(he.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const we=he.sourceEvent.ctrlKey&&bo()?10:1,re=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*e.zoomStep,me=c.value.zoom*2**(re*we);m.value.scaleTo(p.value,me)},J=he=>{if(he.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const we=X.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),re={x:c.value.x-he.sourceEvent.movementX*we,y:c.value.y-he.sourceEvent.movementY*we},me=[[0,0],[u.value.width,u.value.height]],be=Ol.translate(re.x,re.y).scale(c.value.zoom),xe=m.value.constrain()(be,me,d.value);m.value.transform(p.value,xe)},se=ON().wheelDelta(he=>el(he)*(e.zoomStep/10)).on("zoom",e.pannable?J:()=>{}).on("zoom.wheel",e.zoomable?T:()=>{});oe.call(se),W(()=>{oe.on("zoom",null)})}},{flush:"post"});function B(W){const[oe,T]=Kt(W);t("click",{event:W,position:{x:oe,y:T}})}function ee(W,oe){const T={event:W,node:oe,connectedEdges:dn([oe],s.value)};f.miniMapNodeClick(T),t("nodeClick",T)}function v(W,oe){const T={event:W,node:oe,connectedEdges:dn([oe],s.value)};f.miniMapNodeDoubleClick(T),t("nodeDblclick",T)}function R(W,oe){const T={event:W,node:oe,connectedEdges:dn([oe],s.value)};f.miniMapNodeMouseEnter(T),t("nodeMouseenter",T)}function E(W,oe){const T={event:W,node:oe,connectedEdges:dn([oe],s.value)};f.miniMapNodeMouseMove(T),t("nodeMousemove",T)}function P(W,oe){const T={event:W,node:oe,connectedEdges:dn([oe],s.value)};f.miniMapNodeMouseLeave(T),t("nodeMouseleave",T)}return(W,oe)=>(n.openBlock(),n.createBlock(n.unref(dd),{position:W.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:W.pannable,zoomable:W.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:_.value,viewBox:[Q.value.x,Q.value.y,Q.value.width,Q.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:B},[W.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(W.ariaLabel),9,HN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(h),T=>(n.openBlock(),n.createBlock(zN,{id:T.id,key:T.id,f:"",position:T.computedPosition,dimensions:T.dimensions,selected:T.selected,dragging:T.dragging,style:n.normalizeStyle(T.style),class:n.normalizeClass(K.value(T)),color:y.value(T),"border-radius":W.nodeBorderRadius,"stroke-color":$.value(T),"stroke-width":W.nodeStrokeWidth,"shape-rendering":n.unref(N),type:T.type,hidden:T.hidden,onClick:J=>ee(J,T),onDblclick:J=>v(J,T),onMouseenter:J=>R(J,T),onMousemove:J=>E(J,T),onMouseleave:J=>P(J,T)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:de.value,fill:W.maskColor,stroke:W.maskStrokeColor,"stroke-width":W.maskStrokeWidth,"fill-rule":"evenodd"},null,8,FN)],8,UN))]),_:1},8,["position","class"]))}}),WN=["d"],KN=["cx","cy","onDblclick"],qN=["x","y","onPointerdown","onDblclick"],XN=Le(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=De(),i=n.inject(bl),a=n.inject(hn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Pn,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>c.value.map((G,X)=>X===d.value?u.value:G)),{source:p,target:m,sourceSide:h,targetSide:b}=Dd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),g=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?na(p.value,h.value,f.value,m.value,b.value):ia(p.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?oa(p.value,h.value,f.value,m.value,b.value):ra(p.value,f.value,m.value).map((G,X)=>({point:G,segIndex:X})):[]),N=n.computed(()=>l.value?f.value:[]);function y(G,X){d.value=G,u.value={...c.value[G]},X.target.setPointerCapture(X.pointerId),X.stopPropagation()}function $(G){if(d.value<0)return;const X=o({x:G.clientX,y:G.clientY});u.value={x:X.x,y:X.y}}function K(G){var X,Q;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(Q=(X=G.target).releasePointerCapture)==null||Q.call(X,G.pointerId)}function F(G,X){X.stopPropagation(),i==null||i.removePoint(t.id,G)}function q(G,X){if(!i)return;const Q=o({x:X.clientX,y:X.clientY});i.insertPoint(t.id,G,{x:Q.x,y:Q.y})}return(G,X)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,WN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(Q,de)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${de}`,cx:Q.point.x,cy:Q.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(B=>q(Q.segIndex,B),["stop"])},null,42,KN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(Q,de)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${de}`,x:Q.x-5,y:Q.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:B=>y(de,B),onPointermove:$,onPointerup:K,onDblclick:B=>F(de,B)},null,42,qN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),jN=["data-theme"],ZN={key:0,class:"em-ctx__sep",role:"separator"},JN={key:1,class:"em-ctx__swatches"},QN={class:"em-ctx__swatches-label"},e$={class:"em-ctx__chips"},t$=["onClick"],n$=["title","onClick"],o$=["disabled","onClick"],i$={class:"em-ctx__icon"},a$={class:"em-ctx__caption"},l$=Le(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,h){var _;i.value=h,a.value=(_=m.target)!=null&&_.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const b=l.value;if(!b)return;const g=b.getBoundingClientRect();r.x+g.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-g.width)),r.y+g.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-g.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function p(m,h){m.onPick(h),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,h)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(b,g)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:g},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",ZN)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",JN,[n.createElementVNode("span",QN,n.toDisplayString(b.caption),1),n.createElementVNode("div",e$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:"없음",onClick:_=>p(b,null)},null,10,t$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===_}]),style:n.normalizeStyle({background:n.unref(Dn)(_)}),title:n.unref(Bn)(_),onClick:N=>p(b,_)},null,14,n$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:_=>f(b)},[n.createElementVNode("span",i$,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",a$,n.toDisplayString(b.caption),1)],10,o$))],64))),128))],36)],8,jN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Pl=[".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 Fn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function r$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function s$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const h=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const b=t(h.left,h.top+h.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const h=d.trim();if(h){const b=t(f,(u+p)/2);c.push({...i,x:b.x,y:b.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(l,h),a.setEnd(l,h+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(m(),u=b.top,f=b.left,p=b.bottom,d=s[h]):(d+=s[h],p=Math.max(p,b.bottom))}return m(),c}function ea(e,t){const o=[];for(const i of e.querySelectorAll("*"))r$(i)&&(i.closest(Pl)||Fn(i)&&o.push(...s$(i,t)));return o}function Ro(e){return Math.round(e*100)/100}function c$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Pl)||!Fn(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const l=t(a.left,a.top),r=t(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Ro(l.x)}" y="${Ro(l.y)}" width="${Ro(r.x-l.x)}" height="${Ro(r.y-l.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function d$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Fn(o))continue;const i=getComputedStyle(o),a=i.stroke,l=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Ro(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${l}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${l}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${a}" stroke-width="${l}" stroke-linejoin="round" />`)}return t}function Ru(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Pl)||!Fn(a))continue;const l=getComputedStyle(a),r=parseFloat(l.borderTopWidth);if(!r)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:l.borderTopColor,strokeWidth:r})}return i}function Vo(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),l=t(o.right,o.bottom),r=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:l.x-a.x,h:l.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function zl(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function u$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,h)=>e.screenToFlowCoordinate({x:m,y:h}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const h=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!h||!Fn(h))continue;const b=h.firstElementChild;if(b)if(m.type==="group"){const g=Vo(b,o);zl(s,g),i.push({...g,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...Vo(_,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ea(b,o)})}else if(m.type==="note"){const g={...Vo(b,o),texts:ea(b,o),lines:Ru(b,b,o)};zl(s,g),l.push(g)}else{const g=Vo(b,o);zl(s,g);const _=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const N=b.querySelector(".em-entity__header");if(N){const y=Vo(N,o);a.push({x:g.x,y:g.y,w:g.w,h:y.y+y.h-g.y,fill:y.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ea(b,o),lines:Ru(b,b,o),icons:c$(b,o)}),a.push({...g,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const h=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Fn(h))continue;const b=h.getAttribute("d");if(!b)continue;const g=getComputedStyle(h),_=g.strokeDasharray,N=d$(m);r.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ea(m,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:a,notes:l}}function Vu(e){return Zl(u$(e))}function Au(e,t="diagram.svg"){const o=Vu(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i);try{const l=document.createElement("a");l.href=a,l.download=t,document.body.appendChild(l),l.click(),l.remove()}finally{URL.revokeObjectURL(a)}}const Ul="nc:",Tu=Le(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(S){s.x=S.clientX,s.y=S.clientY}const d=n.ref(null);n.provide(Mi,d);const u=n.ref(null);n.provide(wd,u);const f=n.ref(null),p=n.computed(()=>{const S=f.value,D=new Set;if(!S)return D;if(S.kind==="entity")D.add(S.id);else if(S.kind==="group"){const I=i.resolved.value.groups.find(L=>L.group.modelId===S.id);for(const L of(I==null?void 0:I.group.memberEntityRefs)??[])D.add(L)}return D}),m=n.computed(()=>{const S=f.value,D=new Set(p.value),I=new Set,L=new Set;if(!S)return{related:D,edges:I,notes:L};if(S.kind==="note"){L.add(S.id);for(const ue of i.resolved.value.noteConnections)ue.noteRef===S.id&&D.add(ue.targetRef);return{related:D,edges:I,notes:L}}const ie=p.value;if(!ie.size)return{related:D,edges:I,notes:L};for(const ue of i.resolved.value.associations){const{end1:fe,end2:A}=ue.association;(ie.has(fe.entityRef)||ie.has(A.entityRef))&&(I.add(ue.association.modelId),D.add(fe.entityRef),D.add(A.entityRef))}for(const ue of i.resolved.value.noteConnections)D.has(ue.targetRef)&&L.add(ue.noteRef);return{related:D,edges:I,notes:L}});n.provide(Pn,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:p,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var S;return((S=f.value)==null?void 0:S.kind)==="group"?f.value.id:null}),setEntityHover:S=>{u.value||r.value||(f.value=S?{kind:"entity",id:S}:null)},setGroupHover:S=>{u.value||r.value||(f.value=S?{kind:"group",id:S}:null)},setNoteHover:S=>{u.value||r.value||(f.value=S?{kind:"note",id:S}:null)}}),n.provide(hn,i);function h(S,D){return`${Ul}${S}:${D}`}function b(S){if(!S.startsWith(Ul))return null;const[D,I]=S.slice(Ul.length).split(":");return D&&I?{noteRef:D,targetRef:I}:null}n.provide(bl,{points:S=>{var I,L;const D=b(S);return D?((I=i.resolved.value.noteConnections.find(ie=>ie.noteRef===D.noteRef&&ie.targetRef===D.targetRef))==null?void 0:I.waypoints)??[]:((L=i.resolved.value.associations.find(ie=>ie.association.modelId===S))==null?void 0:L.waypoints)??[]},movePoint:(S,D,I)=>{const L=b(S);L?i.moveNoteConnectionWaypoint(L.noteRef,L.targetRef,D,I):i.moveWaypoint(S,D,I)},insertPoint:(S,D,I)=>{const L=b(S);L?i.addNoteConnectionWaypoint(L.noteRef,L.targetRef,D,I):i.addWaypoint(S,D,I)},removePoint:(S,D)=>{const I=b(S);I?i.removeNoteConnectionWaypoint(I.noteRef,I.targetRef,D):i.removeWaypoint(S,D)}});const g=De(),{nodes:_,edges:N,findNode:y,findEdge:$,addNodes:K,addEdges:F,removeNodes:q,removeEdges:G,fitView:X,setCenter:Q,getViewport:de,screenToFlowCoordinate:B,getSelectedNodes:ee,updateNodeInternals:v}=g,R=n.ref(!1);async function E(){R.value=!0,await n.nextTick(),await new Promise(S=>requestAnimationFrame(()=>S(null)));try{Au(g)}finally{R.value=!1}}t({exportSvg:E});function P(){const S=de(),{width:D,height:I}=g.dimensions.value;return{x:(D/2-S.x)/S.zoom,y:(I/2-S.y)/S.zoom}}function W(){const S=P();i.addEntity("NewEntity",{x:S.x,y:S.y})}function oe(){const S=P();i.addNote("메모",{x:S.x,y:S.y})}function T(S){for(const D of i.resolved.value.groups){const{location:I,size:L}=D.geo;if(S.x>=I.x&&S.x<=I.x+L.width&&S.y>=I.y&&S.y<=I.y+L.height)return D.group.modelId}return null}function J(){const S=i.resolved.value,D=new Map(S.groups.map(fe=>[fe.group.modelId,fe.geo])),I=new Set(S.groups.map(fe=>fe.group.modelId)),L=new Set([...I,...S.entities.map(fe=>fe.entity.modelId),...S.notes.map(fe=>fe.note.modelId)]);for(const fe of[..._.value])L.has(fe.id)||q([fe.id]);for(const fe of S.groups){const A=fe.group.modelId,Z={width:`${fe.geo.size.width}px`,height:`${fe.geo.size.height}px`},z={group:fe.group,style:fe.style,locked:fe.locked},ce=fe.locked?!1:void 0,Ae=y(A);Ae?(Ae.position={...fe.geo.location},Ae.data=z,Ae.style=Z,Ae.draggable=ce):K([{id:A,type:"group",position:{...fe.geo.location},draggable:ce,style:Z,data:z}])}for(const fe of S.entities){const A=fe.entity.modelId,Z=fe.groupRef&&I.has(fe.groupRef)?fe.groupRef:void 0,z={entity:fe.entity,displayMode:i.displayMode.value,collapsed:fe.collapsed,locked:fe.locked,groupRef:Z,size:fe.geo.size,style:fe.style,attributeStyles:fe.attributeStyles,operationStyles:fe.operationStyles},ce=fe.locked?!1:void 0,Ae=Z?D.get(Z):void 0,Ue=Ae?{x:fe.geo.location.x-Ae.location.x,y:fe.geo.location.y-Ae.location.y}:{...fe.geo.location},Oe=y(A);Oe?(Oe.position=Ue,Oe.data=z,Oe.parentNode=Z,Oe.draggable=ce):K([{id:A,type:"entity",position:Ue,parentNode:Z,draggable:ce,data:z}])}for(const fe of S.notes){const A=fe.note,Z=A.modelId,z=fe.groupRef&&I.has(fe.groupRef)?fe.groupRef:void 0,ce={note:A,groupRef:z},Ae={width:`${A.geo.size.width}px`,height:`${A.geo.size.height}px`},Ue=z?D.get(z):void 0,Oe=Ue?{x:A.geo.location.x-Ue.location.x,y:A.geo.location.y-Ue.location.y}:{...A.geo.location},Me=y(Z);Me?(Me.position=Oe,Me.data=ce,Me.style=Ae,Me.parentNode=z):K([{id:Z,type:"note",position:Oe,parentNode:z,style:Ae,data:ce}])}const ie=new Map(S.associations.map(fe=>[fe.association.modelId,fe])),ue=new Set(S.noteConnections.map(fe=>h(fe.noteRef,fe.targetRef)));for(const fe of[...N.value])!ie.has(fe.id)&&!ue.has(fe.id)&&G([fe.id]);for(const[fe,A]of ie){const Z={id:fe,type:"association",source:A.association.end1.entityRef,target:A.association.end2.entityRef,sourceHandle:A.sourceColumnRef?`r:${A.sourceColumnRef}`:void 0,targetHandle:A.targetColumnRef?`l:${A.targetColumnRef}`:void 0,data:{association:A.association,sourceColumnRef:A.sourceColumnRef,targetColumnRef:A.targetColumnRef}},z=$(fe);z?(z.data=Z.data,z.sourceHandle=Z.sourceHandle,z.targetHandle=Z.targetHandle):F([Z])}for(const fe of S.noteConnections){const A=h(fe.noteRef,fe.targetRef),Z={noteRef:fe.noteRef,targetRef:fe.targetRef},z=$(A);z?z.data=Z:F([{id:A,type:"note-connection",source:fe.noteRef,target:fe.targetRef,data:Z}])}se()}function se(){n.nextTick(()=>requestAnimationFrame(()=>v()))}function he(){const S=ee.value.map(I=>I.id);if(S.length)return S;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function we(S){var ie;const D=S.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(!i.editable.value){(S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="c"&&(i.copy(),S.preventDefault());return}if(S.key==="Delete"||S.key==="Backspace"){i.deleteSelection()&&S.preventDefault();return}if(S.key==="ArrowUp"||S.key==="ArrowDown"||S.key==="ArrowLeft"||S.key==="ArrowRight"){if(((ie=i.selection.value)==null?void 0:ie.kind)==="attribute"){if(S.key==="ArrowUp"||S.key==="ArrowDown"){const Z=S.key==="ArrowDown"?1:-1;(S.altKey?i.nudgeSelectedAttributes(Z):i.moveAttributeFocus(Z))&&S.preventDefault()}return}const ue=S.shiftKey?10:1,fe=S.key==="ArrowLeft"?-ue:S.key==="ArrowRight"?ue:0,A=S.key==="ArrowUp"?-ue:S.key==="ArrowDown"?ue:0;i.nudgeNodes(he(),fe,A)&&S.preventDefault();return}if(!(S.metaKey||S.ctrlKey))return;const L=S.key.toLowerCase();L==="c"?(i.copy(),S.preventDefault()):L==="v"?(i.paste(),S.preventDefault()):L==="z"&&(S.shiftKey?i.redo():i.undo(),S.preventDefault())}n.onMounted(async()=>{J(),await n.nextTick(),X(),window.addEventListener("keydown",we),window.addEventListener("pointerup",re),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",we),window.removeEventListener("pointerup",re),window.removeEventListener("pointermove",c)});function re(){d.value=null}function me(){r.value=!0,f.value=null}function be(){var L;r.value=!1;const S=(L=document.elementFromPoint(s.x,s.y))==null?void 0:L.closest(".vue-flow__node"),D=S==null?void 0:S.dataset.id;if(!D){f.value=null;return}const I=S.classList.contains("vue-flow__node-group")?"group":S.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:I,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],J),n.watch(()=>i.revision.value,se),n.watch(()=>i.resolved.value,S=>{const D=f.value;if(!D)return;(D.kind==="entity"?S.entities.some(L=>L.entity.modelId===D.id):D.kind==="group"?S.groups.some(L=>L.group.modelId===D.id):S.notes.some(L=>L.note.modelId===D.id))||(f.value=null)});function xe(S){const D=S.computedPosition??S.position,I=S.dimensions??{width:0,height:0};return{x:D.x+I.width/2,y:D.y+I.height/2}}function Ce(S){const D=S.node;if(D){if(f.value=null,D.type==="group"){const I=i.resolved.value.groups.find(L=>L.group.modelId===D.id);u.value=I?{groupId:D.id,dx:D.position.x-I.geo.location.x,dy:D.position.y-I.geo.location.y}:null,d.value=null;return}if(D.type!=="entity"&&D.type!=="note"){d.value=null;return}d.value=T(xe(D))}}function Se(S){var L;d.value=null,u.value=null;const D=(L=S.nodes)!=null&&L.length?S.nodes:[S.node],I=D.filter(ie=>(ie==null?void 0:ie.type)==="group");if(I.length){for(const ie of I){if(!ie)continue;const ue=i.resolved.value.entities.filter(fe=>fe.groupRef===ie.id).map(fe=>{const A=y(fe.entity.modelId),Z=(A==null?void 0:A.computedPosition)??(A==null?void 0:A.position)??{x:0,y:0};return{id:fe.entity.modelId,location:{x:Z.x,y:Z.y}}});i.dragGroup(ie.id,{x:ie.position.x,y:ie.position.y},ue)}return}for(const ie of D){if(!ie||ie.type==="group")continue;const ue=ie.computedPosition??ie.position,fe=ie.dimensions??{width:0,height:0},A={x:ue.x+fe.width/2,y:ue.y+fe.height/2};ie.type==="note"?i.dropNote(ie.id,{x:ue.x,y:ue.y},T(A)):i.dropEntity(ie.id,{x:ue.x,y:ue.y},T(A))}}function ye(S){var Z,z,ce,Ae,Ue;if(!i.editable.value||!S.source||!S.target)return;const D=((Z=y(S.source))==null?void 0:Z.type)==="note",I=((z=y(S.target))==null?void 0:z.type)==="note";if(D||I){if(D&&I)return;const Oe=D?S.source:S.target,Me=D?S.target:S.source;((ce=y(Me))==null?void 0:ce.type)==="entity"&&i.addNoteConnection(Oe,Me);return}const L=Oe=>{var Me;return(Me=i.state.logical.entities.find(st=>st.modelId===Oe))==null?void 0:Me.stereotype},ie=L(S.source)==="JPA_EMBEDDABLE",ue=L(S.target)==="JPA_EMBEDDABLE";if(ie||ue){if(ie&&ue)return;const Oe=ie?S.source:S.target,Me=ie?S.target:S.source;i.addEmbedAssociation(Me,Oe);return}const fe=(Ae=S.sourceHandle)!=null&&Ae.startsWith("r:")?S.sourceHandle.slice(2):void 0,A=(Ue=S.targetHandle)!=null&&Ue.startsWith("l:")?S.targetHandle.slice(2):void 0;i.addAssociation(S.source,S.target,fe,A)}const Y=n.ref(null);function C(S,D){var L;const I=i.state.layout.entityLayouts.find(ie=>ie.entityRef===S);return Qe((L=I==null?void 0:I.attributeStyles)==null?void 0:L[D])}function k(S,D){var L;const I=i.state.layout.entityLayouts.find(ie=>ie.entityRef===S);return Qe((L=I==null?void 0:I.operationStyles)==null?void 0:L[D])}function V(S){var D;return Qe((D=i.state.layout.groupLayouts.find(I=>I.groupRef===S))==null?void 0:D.style)}function H(S){var D;return Qe((D=i.state.layout.notes.find(I=>I.modelId===S))==null?void 0:D.style)}function te(S){var L,ie;if(S.preventDefault(),!i.editable.value)return;const D=()=>B({x:S.clientX,y:S.clientY}),I=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const ue=D();i.addEntity("NewEntity",{x:ue.x,y:ue.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const ue=D();i.addNote("메모",{x:ue.x,y:ue.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const ue=D();i.addEmptyGroup({x:ue.x,y:ue.y})}}];((L=i.clipboard.value)==null?void 0:L.kind)==="entity"&&I.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&I.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(ie=Y.value)==null||ie.open(S,I)}function ne({event:S,node:D}){var Z,z,ce,Ae,Ue,Oe,Me,st,Xt,jt,Zt,Xe,Ao,ke,je,To,Mo,Bo;const I=S;if(I.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const Be=(z=(Z=I.target)==null?void 0:Z.closest("[data-attr]"))==null?void 0:z.dataset.attr;if(Be){const He=i.selection.value;(He==null?void 0:He.kind)==="attribute"&&He.entityId===D.id&&He.ids.includes(Be)||i.selectAttribute(D.id,Be);const $t=((ce=i.selection.value)==null?void 0:ce.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[Be];(Ae=Y.value)==null||Ae.open(I,[{caption:$t.length>1?`복사 (${$t.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ue=Y.value)==null||Ue.open(I,[{caption:"상세 편집…",icon:"pencil",handler:()=>Ai(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const Be=i.isGroupLocked(D.id),He=[];Be||He.push({type:"swatches",caption:"색상",current:V(D.id),onPick:We=>i.setGroupSwatch(D.id,We)},{type:"separator"}),He.push({caption:Be?"잠금 해제":"잠금",icon:Be?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!Be)}),Be||He.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Oe=Y.value)==null||Oe.open(I,He);return}if(D.type==="note"){(Me=Y.value)==null||Me.open(I,[{type:"swatches",caption:"색상",current:H(D.id),onPick:Be=>i.setNoteSwatch(D.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const L=(Xt=(st=I.target)==null?void 0:st.closest("[data-attr]"))==null?void 0:Xt.dataset.attr;if(L){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===D.id&&Be.ids.includes(L)||i.selectAttribute(D.id,L);const We=((jt=i.selection.value)==null?void 0:jt.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[L];if(i.isEntityLocked(D.id)){(Zt=Y.value)==null||Zt.open(I,[{caption:We.length>1?`복사 (${We.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const $t=We.length>1,et=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:$t?`색상 (${We.length})`:"색상",current:$t?null:C(D.id,L),onPick:QI=>i.setAttributeSwatches(D.id,We,QI)},{type:"separator"},{caption:$t?`복사 (${We.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Do=i.clipboard.value;(Do==null?void 0:Do.kind)==="attribute"&&et.push({caption:Do.attributes.length>1?`속성 붙여넣기 (${Do.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),et.push({type:"separator"},{caption:$t?`속성 삭제 (${We.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,We)}),(Xe=Y.value)==null||Xe.open(I,et);return}const ie=(ke=(Ao=I.target)==null?void 0:Ao.closest("[data-op]"))==null?void 0:ke.dataset.op;if(ie){if(i.isEntityLocked(D.id))return;(je=Y.value)==null||je.open(I,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:k(D.id,ie),onPick:Be=>i.setOperationSwatch(D.id,ie,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,ie)}]);return}const ue=i.resolved.value.entities.find(Be=>Be.entity.modelId===D.id),fe=!!(ue!=null&&ue.locked),A=[{caption:fe?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Ai(a,i,D.id)}];if(!fe){A.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const He=ee.value.filter(We=>We.type==="entity").map(We=>We.id);i.createGroup(He.includes(D.id)&&He.length?He:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const Be=i.embeddableCatalog.value;if(Be.length){A.push({type:"separator"});for(const He of Be){const We=((To=He.label)==null?void 0:To.ko)??((Mo=He.label)==null?void 0:Mo.en)??He.type;A.push({caption:`임베더블 추가: ${We}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,He.type)})}}}if(A.push({type:"separator"}),A.push({caption:ue!=null&&ue.collapsed?"펼치기":"접기",icon:ue!=null&&ue.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(ue!=null&&ue.collapsed))}),ue!=null&&ue.groupRef&&!fe&&A.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),A.push({caption:fe?"잠금 해제":"잠금",icon:fe?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!fe)}),A.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!fe){const Be=i.clipboard.value;(Be==null?void 0:Be.kind)==="attribute"&&A.push({caption:Be.attributes.length>1?`속성 붙여넣기 (${Be.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),A.push({type:"separator"}),A.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(Bo=Y.value)==null||Bo.open(I,A)}function ge({event:S,edge:D}){var ie,ue;const I=S;if(I.preventDefault(),!i.editable.value)return;const L=b(D.id);if(L){(ie=Y.value)==null||ie.open(I,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(L.noteRef,L.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(L.noteRef,L.targetRef)}]);return}(ue=Y.value)==null||ue.open(I,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function ve(S){return S==="group"?"group":S==="note"?"note":"entity"}function Ee({node:S}){if(ee.value.length>1){i.selection.value=null;return}i.selection.value={kind:ve(S.type),id:S.id}}function w({nodes:S}){S.length>1&&(i.selection.value=null)}function x({edge:S}){const D=b(S.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:S.id}}function j(S){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===S.id}function le(S){var D,I;return j(S)?S.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":S.type==="note"?"var(--em-note-soft)":S.type==="group"?fd(Qe((D=S.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":fd(Qe((I=S.data)==null?void 0:I.style))??"var(--em-mm-entity)"}function _e(S){return j(S)?"var(--em-selection)":S.type==="note"?"var(--em-note-accent)":S.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function O(S,D){Q(S,D,{zoom:de().zoom,duration:350})}n.watch(()=>i.focusRequest.value,S=>{if(!S)return;const D=y(S.id);if(!D)return;const I=D.computedPosition??D.position,L=D.dimensions??{width:0,height:0};O(I.x+L.width/2,I.y+L.height/2)});function U({position:S}){O(S.x,S.y)}function M({node:S}){i.selection.value={kind:ve(S.type),id:S.id};const D=S.computedPosition??S.position,I=S.dimensions??{width:0,height:0};O(D.x+I.width/2,D.y+I.height/2)}function pe({node:S}){X({nodes:[S.id],duration:350,maxZoom:1.2,padding:.6})}return(S,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":l.value,"is-panning":r.value}])},[n.createVNode(n.unref(T0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!R.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(At).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:me,onMoveEnd:be,onConnect:ye,onConnectStart:D[1]||(D[1]=I=>l.value=!0),onConnectEnd:D[2]||(D[2]=I=>l.value=!1),onNodeDrag:Ce,onNodeDragStop:Se,onNodeClick:Ee,onEdgeClick:x,onSelectionChange:w,onPaneClick:D[3]||(D[3]=I=>n.unref(i).selection.value=null),onPaneContextMenu:te,onNodeContextMenu:ne,onEdgeContextMenu:ge},{"node-group":n.withCtx(I=>[n.createVNode(kd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"node-entity":n.withCtx(I=>[n.createVNode(vd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"node-note":n.withCtx(I=>[n.createVNode(Ed,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"edge-association":n.withCtx(I=>[n.createVNode(Od,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"edge-note-connection":n.withCtx(I=>[n.createVNode(XN,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Ow),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(cv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(yn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:W},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(yn),{title:"노트 추가",onClick:oe},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(yn),{title:"자동 배치",onClick:D[0]||(D[0]=I=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(YN),{key:1,pannable:"",width:224,height:160,"node-color":le,"node-stroke-color":_e,"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:U,onNodeClick:M,onNodeDblclick:pe})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(l$,{ref_key:"menuRef",ref:Y},null,512)],2))}}),[["__scopeId","data-v-eaeafa69"]]),f$={class:"em-explorer em-scroll-overlay"},m$={class:"em-explorer__rows"},p$=["data-key","onClick","onDblclick"],h$=["onClick"],y$=["title"],g$={class:"em-key-slot"},b$={class:"em-key-slot"},_$={class:"em-explorer__label"},Mu=Le(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var v;const _=i.resolved.value,N=i.displayMode.value,y=R=>{var E,P,W;return Oo(N,R.name,(P=(E=R.table)==null?void 0:E.logicalName)==null?void 0:P.ko,(W=R.table)==null?void 0:W.physicalName)},$=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",K=R=>{const E=R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0;return{icon:R.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:R.identifier,fk:E&&$}}},F=R=>R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0,q=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",G=R=>{if(R.attrType!=="EMBED_PREDEF")return R.dbAttrs;const E=i.embeddableCatalog.value.find(P=>P.type===R.type);return E?R.dbAttrs.map((P,W)=>{const oe=E.fields[W];return oe?{...P,physicalName:P.physicalName||oe.physicalName,logicalName:P.logicalName??oe.logicalName,dataType:P.dataType||oe.dataType,length:P.length??oe.length}:P}):R.dbAttrs},X=(R,E)=>{var T,J,se;const P={entityId:E,attrId:R.modelId};if(F(R)){const he=fa(N,R);return{key:`attr:${R.modelId}`,label:R.name+(he?` : ${he}`:""),icon:"table",attrRef:P,focusId:E,children:q?G(R).map(we=>{var re;return{key:`attr:${R.modelId}:col:${we.modelId}`,label:Oo(N,we.physicalName,(re=we.logicalName)==null?void 0:re.ko,we.physicalName)+(we.dataType?` : ${we.dataType}`:""),icon:"field",attrRef:P,focusId:E,children:[]}}):[]}}const W=tr(R,i.state.logical.associations),oe=fa(N,R,W);return{key:`attr:${R.modelId}`,label:Oo(N,R.name,(J=(T=R.dbAttrs[0])==null?void 0:T.logicalName)==null?void 0:J.ko,(se=R.dbAttrs[0])==null?void 0:se.physicalName)+(oe?` : ${oe}`:""),...K(R),attrRef:P,focusId:E,children:[]}},Q=R=>{const E=R.entity,P=[...E.attributes].sort((W,oe)=>W.order-oe.order);return{key:`entity:${E.modelId}`,label:y(E),icon:"table",selectKind:"entity",selectId:E.modelId,focusId:E.modelId,children:P.map(W=>X(W,E.modelId))}},de=new Map,B=[];for(const R of _.entities)if(R.groupRef){const E=de.get(R.groupRef)??[];E.push(R),de.set(R.groupRef,E)}else B.push(R);const ee=[];for(const R of _.groups){const E=R.group;ee.push({key:`group:${E.modelId}`,label:((v=E.name)==null?void 0:v.ko)||E.packageName||"(그룹)",icon:"folder",focusId:E.modelId,children:(de.get(E.modelId)??[]).map(Q)})}for(const R of B)ee.push(Q(R));if(_.associations.length){const R=new Map(_.entities.map(E=>[E.entity.modelId,y(E.entity)]));ee.push({key:"section:associations",label:`관계 (${_.associations.length})`,icon:"arrow-lr",children:_.associations.map(E=>{const P=E.association,W=R.get(P.end1.entityRef)??P.end1.entityRef,oe=R.get(P.end2.entityRef)??P.end2.entityRef;return{key:`assoc:${P.modelId}`,label:`${W} — ${oe}`,icon:"arrow-lr",selectKind:"association",selectId:P.modelId,children:[]}})})}return _.notes.length&&ee.push({key:"section:notes",label:`노트 (${_.notes.length})`,icon:"note",children:_.notes.map(({note:R})=>{var E;return{key:`note:${R.modelId}`,label:((E=R.memo.split(`
41
+ `)[0])==null?void 0:E.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:R.modelId,focusId:R.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:ee}});function r(_){return _?_.pk&&_.fk?"PFK (식별 외래키)":_.pk?"PK (기본키)":_.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(_){const N=new Set(s.value);N.has(_)?N.delete(_):N.add(_),s.value=N}const d=n.computed(()=>{const _=[],N=(y,$)=>{if(_.push({node:y,depth:$}),!s.value.has(y.key))for(const K of y.children)N(K,$+1)};return N(l.value,0),_}),u=n.computed(()=>{const _=[],N=y=>{if(y.children.length){y.key!=="root"&&_.push(y.key);for(const $ of y.children)N($)}};return N(l.value),_}),f=n.computed(()=>!u.value.some(_=>s.value.has(_)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(_){const N=i.selection.value;return _.attrRef?(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.attrRef.entityId&&N.ids.includes(_.attrRef.attrId):!!N&&N.kind!=="attribute"&&!!_.selectId&&_.selectKind===N.kind&&_.selectId===N.id}function h(_){const N=i.selection.value;return _.selectKind==="entity"&&(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.selectId}function b(_,N){if(_.attrRef){const y=N.shiftKey?"range":N.metaKey||N.ctrlKey?"toggle":"replace";i.selectAttribute(_.attrRef.entityId,_.attrRef.attrId,y)}else _.selectKind&&_.selectId&&(i.selection.value={kind:_.selectKind,id:_.selectId});_.focusId&&i.requestFocus(_.focusId)}function g(_){_.selectKind==="entity"&&_.selectId&&Ai(a,i,_.selectId)}return(_,N)=>(n.openBlock(),n.createElementBlock("section",f$,[n.createElementVNode("div",m$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:y,depth:$})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":h(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+$*14+"px"}),onClick:K=>b(y,K),onDblclick:K=>g(y)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!y.children.length,"is-open":!s.value.has(y.key)}]),onClick:n.withModifiers(K=>y.children.length&&c(y.key),["stop"])},[y.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,h$),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",g$,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",b$,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,y$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",_$,n.toDisplayString(y.label),1)],46,p$))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),w$={class:"em-text-preview"},v$={class:"em-text-preview__pre"},k$={class:"em-text-preview__actions"},E$=Le(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=ae.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.showNotification("복사에 실패했습니다.","error")}}return(a,l)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",w$,[n.createElementVNode("pre",v$,n.toDisplayString(t.text),1),n.createElementVNode("div",k$,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:l[0]||(l[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),N$={class:"em-toolbar"},$$={class:"em-toolbar__mode"},Bu=Le(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ae.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:p=>i.displayMode.value=p});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const p=i.resolved.value.entities;return p.length>0&&p.every(m=>m.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){l.openModal({component:E$,bind:{text:Xl(i.state.logical)}})}return(p,m)=>(n.openBlock(),n.createElementBlock("div",N$,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:m[0]||(m[0]=h=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:m[1]||(m[1]=h=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),m[9]||(m[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",$$,[m[7]||(m[7]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":m[2]||(m[2]=h=>s.value=h),items:r,"value-provider":h=>h.v,"label-provider":h=>h.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:m[3]||(m[3]=h=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:m[4]||(m[4]=h=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),m[10]||(m[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:m[5]||(m[5]=h=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[m[8]||(m[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:m[6]||(m[6]=h=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-13589c57"]]),x$=Le(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,a)=>(n.openBlock(),n.createBlock(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:a[0]||(a[0]=l=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),I$=["disabled"],S$={class:"em-panel__sub"},C$={class:"em-nav"},R$={key:0,class:"em-nav__divider","aria-hidden":"true"},V$={key:1},A$=["onClick","onKeydown"],T$={class:"em-nav__name"},M$=["title"],B$={key:0,class:"em-panel__note"},D$=["data-attr-block"],O$={class:"em-attr__row"},L$={key:0,class:"em-attr__row"},P$={class:"em-attr__row"},z$={class:"em-attr__row"},U$={class:"em-attr__flags"},H$={class:"em-attr__pii"},F$={class:"em-attr__pii"},G$={class:"em-attr__pii"},Y$={key:0,class:"em-attr__pii em-attr__codetop"},W$={class:"em-multilang"},K$={key:2,class:"em-embed-cols"},q$={class:"em-embed-col__label"},X$={class:"em-attr__row"},j$={class:"em-attr__row"},Z$={key:0,class:"em-embed-upd"},J$={class:"em-embed-upd"},Q$={class:"em-embed-upd"},ex={class:"em-swatch__row em-attr__swatch"},tx=["onClick"],nx=["title","onClick"],ox={key:0,class:"em-attr__swatch-hint"},ta="__OWN__",ix=Le(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(A=>A.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(A=>A.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var A;return((A=i.value)==null?void 0:A.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var A;return((A=i.value)==null?void 0:A.attributes.filter(Z=>Z.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var A;return((A=i.value)==null?void 0:A.attributes)??[]}),d=n.computed(()=>s.value.filter(A=>r.value.has(A.modelId)));function u(A){return{pk:A.identifier,fk:A.attrType.startsWith("RELATION")&&A.dbAttrs.length>0,required:A.notNull&&!A.identifier}}function f(A){const Z=u(A),z=[Z.pk&&"PK",Z.fk&&"FK",Z.required&&"NOT NULL"].filter(Boolean);return z.length?z.join(" · "):void 0}function p(A,Z){i.value&&o.selectAttribute(i.value.modelId,A.modelId,Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace")}const m=["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 h(A){return A==="none"?"(없음)":A}const b=A=>A;function g(A){var Z,z;return Qe((z=(Z=a.value)==null?void 0:Z.attributeStyles)==null?void 0:z[A.modelId])}function _(A){return r.value.size>1&&r.value.has(A.modelId)}function N(A,Z){if(!i.value)return;const z=_(A)?o.selectedAttrIds.value:[A.modelId];o.setAttributeSwatches(i.value.modelId,z,Z)}function y(A,Z){i.value&&o.updateAttribute(i.value.modelId,A.modelId,Z)}function $(A,Z){y(A,{naturalId:Z||void 0,naturalIdMutable:Z?A.naturalIdMutable:void 0})}function K(){return{naturalId:void 0,naturalIdMutable:void 0}}function F(A,Z){y(A,{identifier:Z,...Z?K():{}})}function q(A,Z){y(A,{transient:Z||void 0,...Z?K():{}})}function G(A){return!!A.transient}const X=A=>A.value,Q=A=>A.label;function de(A,Z){if(!Z)return;const z=oe.value.find(ce=>ce.type===Z);if(z){const ce=A.dbAttrs[0]??{modelId:A.modelId+".c",physicalName:A.name,dataType:"VARCHAR"};y(A,{type:Z,customType:void 0,dbAttrs:[{...ce,dataType:z.dataType,length:z.length,scale:z.scale}]});return}y(A,Z===Ot?{type:Z}:{type:Z,customType:void 0})}function B(A,Z){y(A,{customType:Z.trim()===""?void 0:Z})}function ee(A,Z){const ce={...A.dbAttrs[0]??{modelId:A.modelId+".c",physicalName:A.name,dataType:"VARCHAR"},...Z};Z.dataType!==void 0&&!Lo.has(ce.dataType)&&(ce.scale=void 0),y(A,{dbAttrs:[ce]})}function v(A){var Z;return Lo.has(((Z=A.dbAttrs[0])==null?void 0:Z.dataType)??"")}function R(A,Z,z){var ce;ee(A,{logicalName:{...(ce=A.dbAttrs[0])==null?void 0:ce.logicalName,[Z]:z}})}function E(A,Z){y(A,{description:Object.keys(Z).length?Z:void 0})}function P(A){return A.personalInfoAttributeType??"none"}function W(A,Z){y(A,{personalInfoAttributeType:Z==="none"?void 0:Z})}const oe=n.computed(()=>o.predefinedCustomTypeCatalog.value),T=n.computed(()=>o.embeddableCatalog.value),J=n.ref(void 0);function se(A){var Z,z;return((Z=A.label)==null?void 0:Z.ko)??((z=A.label)==null?void 0:z.en)??A.type}function he(A){if(!A||!i.value)return;const Z=o.addPredefinedEmbed(i.value.modelId,A);Z&&o.selectAttribute(i.value.modelId,Z),J.value=void 0}function we(){if(!i.value)return;const A=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,A)}const re=n.computed(()=>o.groupCodeCatalog.value);function me(A){var Z;return((Z=re.value.find(z=>z.groupCode===A.groupCode))==null?void 0:Z.codes)??[]}function be(A){return["none",...me(A)]}function xe(A){return A==="none"?"none":A.code}function Ce(A){var z,ce;if(A==="none")return"(없음)";const Z=((z=A.label)==null?void 0:z.ko)??((ce=A.label)==null?void 0:ce.en);return Z?`${A.code} (${Z})`:A.code}function Se(A,Z){i.value&&o.setAttributeGroupCode(i.value.modelId,A.modelId,Z)}function ye(A,Z){y(A,{defaultValue:Z==="none"?void 0:Z})}function Y(A,Z){y(A,{defaultValue:Z.trim()===""?void 0:Z})}function C(A){return A.attrType.startsWith("EMBED")&&A.dbAttrs.length>0}function k(A,Z,z){const ce=A.dbAttrs.map((Ae,Ue)=>{if(Ue!==Z)return Ae;const Oe={...Ae,...z};for(const Me of Object.keys(z))z[Me]===void 0&&delete Oe[Me];return Oe});i.value&&o.setEmbedColumns(i.value.modelId,A.modelId,ce)}function V(A,Z,z,ce){var Ae;k(A,Z,{logicalName:{...(Ae=A.dbAttrs[Z])==null?void 0:Ae.logicalName,[z]:ce}})}function H(A,Z){var Ae,Ue,Oe;if(A.attrType==="EMBED_PREDEF"){const Me=(Ae=o.embeddableCatalog.value.find(st=>st.type===A.type))==null?void 0:Ae.fields[Z];return Me?{name:Me.name,physicalName:Me.physicalName,dataType:Me.dataType,length:Me.length,shareable:Me.shareable,logicalName:Me.logicalName}:void 0}const z=(Ue=A.embedded)==null?void 0:Ue.embeddableRef;if(!z)return;const ce=(Oe=o.state.logical.entities.find(Me=>Me.modelId===z))==null?void 0:Oe.attributes.flatMap(Me=>Me.dbAttrs)[Z];return ce?{physicalName:ce.physicalName,dataType:ce.dataType,length:ce.length,scale:ce.scale,logicalName:ce.logicalName}:void 0}function te(A,Z){var z,ce;return((z=H(A,Z))==null?void 0:z.dataType)||((ce=A.dbAttrs[Z])==null?void 0:ce.dataType)||""}function ne(A,Z){var z,ce;return((z=H(A,Z))==null?void 0:z.length)??((ce=A.dbAttrs[Z])==null?void 0:ce.length)}function ge(A,Z){var z,ce;return((z=H(A,Z))==null?void 0:z.scale)??((ce=A.dbAttrs[Z])==null?void 0:ce.scale)}const ve=["inherit","true","false"];function Ee(A){return A==="inherit"?"기본(따름)":A}function w(A){return(A==null?void 0:A.updatable)===void 0?"inherit":A.updatable?"true":"false"}function x(A,Z,z){k(A,Z,{updatable:z==="inherit"?void 0:z==="true"})}function j(A,Z){ee(A,{updatable:Z==="inherit"?void 0:Z==="true"})}const le=["inherit","true","false"];function _e(A){return A==="inherit"?"기본(따름)":A}function O(A){return(A==null?void 0:A.insertable)===void 0?"inherit":A.insertable?"true":"false"}function U(A,Z,z){k(A,Z,{insertable:z==="inherit"?void 0:z==="true"})}function M(A,Z){ee(A,{insertable:Z==="inherit"?void 0:Z==="true"})}const pe=n.computed(()=>{var A;return Wn(((A=i.value)==null?void 0:A.attributes.flatMap(Z=>Z.dbAttrs))??[])}),S=n.computed(()=>{var A;return(((A=i.value)==null?void 0:A.attributes)??[]).filter(Z=>Z.attrType==="NORMAL"&&Z.dbAttrs.length===1&&Z.dbAttrs[0]).map(Z=>({modelId:Z.dbAttrs[0].modelId,label:Z.dbAttrs[0].physicalName||Z.name}))});function D(){return[ta,...S.value.map(A=>A.modelId)]}function I(A){if(A===ta)return"전용 컬럼(OWN)";const Z=S.value.find(z=>z.modelId===A);return Z?`↗ ${Z.label} (공유)`:A}function L(A){return(A==null?void 0:A.sharedColumnRef)??ta}function ie(A,Z,z){k(A,Z,{sharedColumnRef:z===ta?void 0:z})}function ue(A){return(A==null?void 0:A.sharedColumnRef)!=null}function fe(A){var Z;return((Z=Po(A,pe.value))==null?void 0:Z.physicalName)??""}return(A,Z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",S$,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:we}),T.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":J.value,items:T.value,"value-provider":z=>z.type,"label-provider":se,"onUpdate:modelValue":he},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",C$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,z=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:z.modelId},[z.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",R$,[...Z[0]||(Z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",V$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(z.modelId)}]),role:"button",tabindex:"0",onClick:ce=>p(z,ce),onKeydown:[n.withKeys(n.withModifiers(ce=>p(z,ce),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ce=>p(z,ce),["prevent"]),["space"])]},[n.createElementVNode("span",T$,n.toDisplayString(z.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(z)},[u(z).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(z).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(z).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,M$)],42,A$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",B$," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,z=>{var ce,Ae,Ue,Oe,Me,st,Xt,jt,Zt,Xe,Ao;return n.openBlock(),n.createElementBlock("div",{key:z.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(z.modelId)}]),"data-attr-block":z.modelId},[n.createElementVNode("div",O$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${z.modelId}`,width:"100%",placeholder:"이름","model-value":z.name,"onUpdate:modelValue":ke=>y(z,{name:ke})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${z.modelId}`,width:"84px",placeholder:"타입",disabled:z.attrType.startsWith("EMBED")||!!z.groupCode,items:n.unref(er)(z.type,oe.value),"value-provider":X,"label-provider":Q,"model-value":z.type,"onUpdate:modelValue":ke=>de(z,ke)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ke=>n.unref(o).removeAttribute(i.value.modelId,z.modelId)},null,8,["onClick"])]),z.type===n.unref(Ot)?(n.openBlock(),n.createElementBlock("div",L$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${z.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":z.customType??"","onUpdate:modelValue":ke=>B(z,ke)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),C(z)?(n.openBlock(),n.createElementBlock("div",K$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.dbAttrs,(ke,je)=>{var To,Mo,Bo,Be,He,We,$t;return n.openBlock(),n.createElementBlock("div",{key:ke.modelId,class:"em-embed-col"},[n.createElementVNode("span",q$,n.toDisplayString(((To=H(z,je))==null?void 0:To.name)??((Mo=H(z,je))==null?void 0:Mo.physicalName)??`컬럼 ${je+1}`),1),n.createElementVNode("div",X$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${ke.modelId}`,width:"100%",disabled:ue(ke),placeholder:((Bo=H(z,je))==null?void 0:Bo.physicalName)??"컬럼","model-value":ue(ke)?fe(ke):ke.physicalName,"onUpdate:modelValue":et=>k(z,je,{physicalName:et})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSTextInput),{name:`embed-dtype-${ke.modelId}`,width:"84px",disabled:"","model-value":te(z,je)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${ke.modelId}`,width:"48px",disabled:"","model-value":ne(z,je)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${ke.modelId}`,width:"48px",disabled:"","model-value":ge(z,je)},null,8,["name","model-value"])]),n.createVNode(pn,{controller:n.unref(o),"ref-id":ke.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",j$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${ke.modelId}`,width:"100%",placeholder:((He=(Be=H(z,je))==null?void 0:Be.logicalName)==null?void 0:He.ko)??"논리명","model-value":((We=ke.logicalName)==null?void 0:We.ko)??"","onUpdate:modelValue":et=>V(z,je,"ko",et)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),($t=H(z,je))!=null&&$t.shareable?(n.openBlock(),n.createElementBlock("label",Z$,[Z[7]||(Z[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":L(ke),items:D(),"value-provider":b,"label-provider":I,"onUpdate:modelValue":et=>et&&ie(z,je,et)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",J$,[Z[8]||(Z[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:ue(ke),"model-value":ue(ke)?"false":O(ke),items:le,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":et=>et&&U(z,je,et)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Q$,[Z[9]||(Z[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:ue(ke),"model-value":ue(ke)?"false":w(ke),items:ve,"value-provider":b,"label-provider":Ee,"onUpdate:modelValue":et=>et&&x(z,je,et)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",P$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${z.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ae=(ce=z.dbAttrs[0])==null?void 0:ce.logicalName)==null?void 0:Ae.ko)??"","onUpdate:modelValue":ke=>R(z,"ko",ke)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",z$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${z.modelId}`,width:"100%",placeholder:"컬럼",disabled:G(z),"model-value":((Ue=z.dbAttrs[0])==null?void 0:Ue.physicalName)??"","onUpdate:modelValue":ke=>ee(z,{physicalName:ke})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${z.modelId}`,width:"84px",placeholder:"dataType",disabled:G(z),items:n.unref(Jl)(((Oe=z.dbAttrs[0])==null?void 0:Oe.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(ca),"model-value":((Me=z.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":ke=>ke&&ee(z,{dataType:ke})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${z.modelId}`,width:"48px",placeholder:"len",disabled:G(z),"model-value":(st=z.dbAttrs[0])==null?void 0:st.length,"onUpdate:modelValue":ke=>ee(z,{length:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${z.modelId}`,width:"48px",placeholder:"scale",disabled:G(z)||!v(z),"model-value":(Xt=z.dbAttrs[0])==null?void 0:Xt.scale,"onUpdate:modelValue":ke=>ee(z,{scale:ke||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(pn,{controller:n.unref(o),"ref-id":(jt=z.dbAttrs[0])==null?void 0:jt.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",U$,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${z.modelId}`,label:"Primary Key","model-value":z.identifier,disabled:l.value||G(z),"onUpdate:modelValue":ke=>F(z,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${z.modelId}`,label:"Not Null","model-value":z.notNull,disabled:G(z),"onUpdate:modelValue":ke=>y(z,{notNull:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${z.modelId}`,label:"Unique","model-value":!!((Zt=z.dbAttrs[0])!=null&&Zt.unique),disabled:G(z),"onUpdate:modelValue":ke=>ee(z,{unique:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${z.modelId}`,label:"Auto Increment","model-value":!!((Xe=z.dbAttrs[0])!=null&&Xe.autoIncrement),disabled:G(z)||!z.identifier,"onUpdate:modelValue":ke=>ee(z,{autoIncrement:ke})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${z.modelId}`,label:"@Transient","model-value":!!z.transient,disabled:z.identifier,"onUpdate:modelValue":ke=>q(z,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nid-${z.modelId}`,label:"@NaturalId","model-value":!!z.naturalId,disabled:z.identifier||G(z),"onUpdate:modelValue":ke=>$(z,ke)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${z.modelId}`,label:"mutable","model-value":!!z.naturalIdMutable,disabled:G(z)||!z.naturalId,"onUpdate:modelValue":ke=>y(z,{naturalIdMutable:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${z.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ao=z.dbAttrs[0])!=null&&Ao.multiValue),disabled:G(z),"onUpdate:modelValue":ke=>ee(z,{multiValue:ke||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",H$,[Z[1]||(Z[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:G(z),"model-value":O(z.dbAttrs[0]),items:le,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":ke=>ke&&M(z,ke)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",F$,[Z[2]||(Z[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:G(z),"model-value":w(z.dbAttrs[0]),items:ve,"value-provider":b,"label-provider":Ee,"onUpdate:modelValue":ke=>ke&&j(z,ke)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",G$,[Z[3]||(Z[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":P(z),items:m,"value-provider":b,"label-provider":h,"onUpdate:modelValue":ke=>ke&&W(z,ke)},null,8,["model-value","onUpdate:modelValue"])]),re.value.length?(n.openBlock(),n.createElementBlock("label",Y$,[Z[4]||(Z[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(hd,{"model-value":z.groupCode,items:re.value,"onUpdate:modelValue":ke=>Se(z,ke)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!re.value.length}])},[Z[5]||(Z[5]=n.createElementVNode("span",null,"기본값",-1)),me(z).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":z.defaultValue??"none",items:be(z),"value-provider":xe,"label-provider":Ce,"onUpdate:modelValue":ke=>ke&&ye(z,ke)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${z.modelId}`,width:"100%",placeholder:"기본값","model-value":z.defaultValue??"","onUpdate:modelValue":ke=>Y(z,ke)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",W$,[Z[6]||(Z[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(pl,{multiline:"",name:`attr-desc-${z.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":z.description,"onUpdate:modelValue":ke=>E(z,ke)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",ex,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(z)===null}]),title:"없음",onClick:ke=>N(z,null)},"∅",10,tx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),ke=>(n.openBlock(),n.createElementBlock("button",{key:ke,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(z)===ke}]),style:n.normalizeStyle({background:n.unref(Dn)(ke)}),title:n.unref(Bn)(ke),onClick:je=>N(z,ke)},null,14,nx))),128)),_(z)?(n.openBlock(),n.createElementBlock("span",ox,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,D$)}),128))],8,I$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-5b6c4296"]]),ax=["disabled"],lx={class:"em-panel__sub-label"},rx={class:"em-attr__row"},sx={class:"em-field em-idx-params"},cx=["value","onChange"],dx=Le(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(m=>m.modelId===o.entityId)??null);function r(){var h;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Te(),name:`idx_${(((h=l.value.indexes)==null?void 0:h.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,h){l.value&&a.updateIndex(l.value.modelId,m,h)}function c(m){var b;const h=(b=l.value)==null?void 0:b.attributes[0];h&&s(m.modelId,{columns:[...m.columns,{columnRef:h.modelId,descending:!1}]})}function d(m,h,b){s(m.modelId,{columns:m.columns.map((g,_)=>_===h?{...g,columnRef:b}:g)})}function u(m,h,b){s(m.modelId,{columns:m.columns.map((g,_)=>_===h?{...g,descending:b}:g)})}function f(m,h){s(m.modelId,{columns:m.columns.filter((b,g)=>g!==h)})}function p(m,h){s(m.modelId,{parameters:h.trim()===""?void 0:h})}return(m,h)=>{var b;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:h[0]||(h[0]=g=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",lx,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 인덱스 ("+n.toDisplayString(((b=l.value.indexes)==null?void 0:b.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],g=>(n.openBlock(),n.createElementBlock("div",{key:g.modelId,class:"em-attr"},[n.createElementVNode("div",rx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${g.modelId}`,width:"100%",placeholder:"인덱스명","model-value":g.name,"onUpdate:modelValue":_=>s(g.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${g.modelId}`,class:"em-check",label:"UQ","model-value":g.unique,"onUpdate:modelValue":_=>s(g.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,g.modelId)},null,8,["onClick"])]),n.createVNode(pn,{controller:n.unref(a),"ref-id":g.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.columns,(_,N)=>(n.openBlock(),n.createElementBlock("div",{key:N,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&d(g,N,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${g.modelId}-desc-${N}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":y=>u(g,N,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:y=>f(g,N)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(g)},null,8,["onClick"]),n.createElementVNode("label",sx,[h[1]||(h[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:g.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>p(g,_.target.value)},null,40,cx)])]))),128)):n.createCommentVNode("",!0)],8,ax)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),ux=["disabled"],fx={class:"em-panel__sub-label"},mx={class:"em-attr__row"},px={class:"em-attr__row"},hx={class:"em-multilang"},yx={class:"em-attr__pii"},gx={class:"em-swatch__row em-attr__swatch"},bx=["onClick"],_x=["title","onClick"],wx=Le(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ae.useModal(),r=n.computed(()=>a.state.logical.entities.find(y=>y.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(y=>y.entityRef===r.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(y){return y==="none"?"(없음)":y}const f=y=>y;function p(y,$){r.value&&a.updateOperation(r.value.modelId,y.modelId,$)}function m(y,$){p(y,{description:Object.keys($).length?$:void 0})}function h(y){return y.personalInfoAttributeType??"none"}function b(y,$){p(y,{personalInfoAttributeType:$==="none"?void 0:$})}function g(y){var $,K;return Qe((K=($=s.value)==null?void 0:$.operationStyles)==null?void 0:K[y.modelId])}function _(y,$){r.value&&a.setOperationSwatch(r.value.modelId,y.modelId,$)}function N(y){l.openModal({component:yd,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:$=>p(y,{sourceCode:$})}})}return(y,$)=>{var K;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:$[1]||($[1]=F=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",fx,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((K=r.value.operations)==null?void 0:K.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:$[0]||($[0]=n.withModifiers(F=>n.unref(a).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],F=>(n.openBlock(),n.createElementBlock("div",{key:F.modelId,class:"em-attr"},[n.createElementVNode("div",mx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${F.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":F.name,"onUpdate:modelValue":q=>p(F,{name:q})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":F.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":q=>q&&p(F,{visibility:q})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:q=>n.unref(a).removeOperation(r.value.modelId,F.modelId)},null,8,["onClick"])]),n.createElementVNode("div",px,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:F.sourceCode?"본문 편집 ●":"본문 편집",onClick:q=>N(F)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",hx,[$[2]||($[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(pl,{multiline:"",name:`op-desc-${F.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":F.description,"onUpdate:modelValue":q=>m(F,q)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",yx,[$[3]||($[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":h(F),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":q=>q&&b(F,q)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",gx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(F)===null}]),title:"없음",onClick:q=>_(F,null)},"∅",10,bx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),q=>(n.openBlock(),n.createElementBlock("button",{key:q,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(F)===q}]),style:n.normalizeStyle({background:n.unref(Dn)(q)}),title:n.unref(Bn)(q),onClick:G=>_(F,q)},null,14,_x))),128))])]))),128)):n.createCommentVNode("",!0)],8,ux)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),vx={class:"em-panel__head"},kx={class:"em-panel__head-row"},Ex={class:"em-panel__context"},Nx={key:0,class:"em-panel__lock"},$x=["disabled"],xx={key:0,class:"em-panel__note"},Ix={key:1,class:"em-panel__note"},Sx={key:2,class:"em-jpa"},Cx={class:"em-field"},Rx={class:"em-field"},Vx={key:0,class:"em-field"},Ax={class:"em-panel__sub"},Tx={class:"em-field"},Mx={class:"em-jpa"},Bx={key:0,class:"em-panel__note"},Dx={class:"em-jpa"},Ox={class:"em-field"},Lx={key:0,class:"em-panel__note"},Px={class:"em-field"},zx={class:"em-multilang"},Ux={class:"em-field"},Hx=["value"],Fx={class:"em-field"},Gx={class:"em-swatch"},Yx={class:"em-swatch__row"},Wx=["title","onClick"],Kx={class:"em-panel__note"},qx={class:"em-field"},Xx=["value"],jx={class:"em-swatch"},Zx={class:"em-swatch__row"},Jx=["title","onClick"],Du=Le(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.selection.value),r=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const Y=r.value;return Y?a.state.logical.entities.find(C=>C.modelId===Y)??null:null}),c=n.computed(()=>{const Y=l.value;if((Y==null?void 0:Y.kind)==="association"){const k=a.state.logical.associations.find(V=>V.modelId===Y.id);return!!k&&(a.isEntityLocked(k.end1.entityRef)||a.isEntityLocked(k.end2.entityRef))}const C=r.value;return!!C&&a.isEntityLocked(C)}),d=n.computed(()=>{var Y;return((Y=a.selectedAttr.value)==null?void 0:Y.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),p=n.ref({});n.watch(f,()=>{p.value={}});function m(Y){return p.value[Y]??f.value}function h(Y){p.value={...p.value,[Y]:!m(Y)}}const b=n.computed(()=>{var k;const Y=s.value;if(!Y)return"엔티티";const C=(k=Y.table)==null?void 0:k.physicalName;return C?`${Y.name} (${C})`:Y.name}),g=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="association"?a.state.logical.associations.find(C=>C.modelId===Y.id)??null:null}),_=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="group"?a.state.logical.groups.find(C=>C.modelId===Y.id)??null:null}),N=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="note"?a.state.layout.notes.find(C=>C.modelId===Y.id)??null:null}),y=n.computed(()=>{var C,k;const Y=(C=_.value)==null?void 0:C.name;return(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((k=_.value)==null?void 0:k.packageName)||"그룹"}),$=n.computed(()=>{if(s.value){const Y=u.value.size;if(Y>1)return`엔티티 · ${s.value.name} › 속성 · ${Y}개`;if(d.value){const C=s.value.attributes.find(k=>k.modelId===d.value);return(C==null?void 0:C.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(C==null?void 0:C.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const Y=C=>{var k;return((k=a.state.logical.entities.find(V=>V.modelId===C))==null?void 0:k.name)??C};return`관계 · ${Y(g.value.end1.entityRef)} — ${Y(g.value.end2.entityRef)}`}return _.value?`그룹 · ${y.value}`:N.value?"노트":"선택된 항목 없음"}),K=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],F=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],q=["LIST","SET"],G=["inherit","LAZY","EAGER"],X=Y=>Y;function Q(Y){return Y==="inherit"?"기본(따름)":Y}const de=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function B(Y,C){g.value&&a.updateAssociationEnd(g.value.modelId,Y,C)}function ee(Y){g.value&&!de.value&&a.setAssociationIdentifying(g.value.modelId,Y)}function v(Y){var C,k,V;return!!((V=(k=(C=g.value)==null?void 0:C[Y].jpa)==null?void 0:k.cascadeTypes)!=null&&V.includes("ALL"))}function R(Y,C,k){var te,ne;const V=(te=g.value)==null?void 0:te[Y];if(C==="ALL"&&k){B(Y,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:["ALL"]}});return}const H=new Set(((ne=V==null?void 0:V.jpa)==null?void 0:ne.cascadeTypes)??[]);k?H.add(C):H.delete(C),B(Y,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:[...H]}})}function E(Y,C){var V;const k=(V=g.value)==null?void 0:V[Y];B(Y,{jpa:{...k==null?void 0:k.jpa,...C}})}function P(Y){var C,k;return((k=(C=g.value)==null?void 0:C[Y].jpa)==null?void 0:k.fetchType)??"inherit"}function W(Y,C){E(Y,{fetchType:C==="inherit"?void 0:C})}function oe(Y){var k;const C=(k=g.value)==null?void 0:k[Y==="end1"?"end2":"end1"];return(C==null?void 0:C.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(C==null?void 0:C.multiplicity)==="ONE_OR_MORE_INSTANCES"}const T=n.computed(()=>{const Y=g.value;if(!Y)return null;for(const C of a.state.logical.entities){const k=C.attributes.find(te=>{var ne;return((ne=te.embedded)==null?void 0:ne.associationRef)===Y.modelId&&te.attrType==="EMBED_OWN"});if(!k)continue;const V=Y.end2.entityRef===k.embedded.embeddableRef?"end2":"end1",H=Y[V].jpa;return{which:V,isCollection:Y[V].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(H==null?void 0:H.collectionType)??"LIST",collectionTable:(H==null?void 0:H.collectionTable)??"",orderColumn:(H==null?void 0:H.orderColumn)??""}}return null});function J(Y){g.value&&a.setEmbedCollectionMode(g.value.modelId,Y?"COLLECTION":"SINGLE")}function se(Y){const C=T.value;C&&E(C.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function he(Y){const C=T.value;C&&E(C.which,{collectionTable:Y.trim()||void 0})}function we(Y){const C=T.value;C&&E(C.which,{orderColumn:Y.trim()||void 0})}function re(Y){_.value&&a.updateGroup(_.value.modelId,Y)}function me(Y,C){var k;re({name:{...(k=_.value)==null?void 0:k.name,[Y]:C}})}const be=n.computed(()=>{var Y;return _.value?Qe((Y=a.state.layout.groupLayouts.find(C=>C.groupRef===_.value.modelId))==null?void 0:Y.style):null});function xe(Y){_.value&&a.setGroupSwatch(_.value.modelId,Y)}function Ce(Y){N.value&&a.setNoteMemo(N.value.modelId,Y)}const Se=n.computed(()=>{var Y;return Qe((Y=N.value)==null?void 0:Y.style)});function ye(Y){N.value&&a.setNoteSwatch(N.value.modelId,Y)}return(Y,C)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:C[0]||(C[0]=(...k)=>e.startResize&&e.startResize(...k))},null,34),n.createElementVNode("header",vx,[n.createElementVNode("div",kx,[C[13]||(C[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:C[1]||(C[1]=k=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",Ex,n.toDisplayString($.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",Nx,[n.createVNode(Ve,{name:"lock",size:13}),C[14]||(C[14]=n.createElementVNode("span",null,"편집 잠김 — 이동·수정·삭제 차단",-1)),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:C[2]||(C[2]=k=>n.unref(a).setEntityLocked(r.value,!1))},"잠금 해제")):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(md,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:b.value,onToggle:C[3]||(C[3]=k=>h("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(ix,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(dx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:C[4]||(C[4]=k=>h("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(wx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:C[5]||(C[5]=k=>h("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ae.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!g.value.identifying,disabled:de.value||!!T.value,"onUpdate:modelValue":ee},null,8,["model-value","disabled"]),de.value?(n.openBlock(),n.createElementBlock("p",xx,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):T.value?(n.openBlock(),n.createElementBlock("p",Ix,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),T.value?(n.openBlock(),n.createElementBlock("fieldset",Sx,[C[18]||(C[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":T.value.isCollection,"onUpdate:modelValue":J},null,8,["model-value"]),T.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",Cx,[C[15]||(C[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":T.value.collectionType,items:q,"value-provider":X,"label-provider":X,"onUpdate:modelValue":C[6]||(C[6]=k=>k&&se(k))},null,8,["model-value"])]),n.createElementVNode("label",Rx,[C[16]||(C[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":T.value.collectionTable,"onUpdate:modelValue":he},null,8,["model-value"])]),T.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",Vx,[C[17]||(C[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":T.value.orderColumn,"onUpdate:modelValue":we},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),C[19]||(C[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],k=>{var V,H,te,ne;return n.createElementVNode("div",{key:k,class:"em-end"},[n.createElementVNode("h4",Ax,n.toDisplayString(k)+" → "+n.toDisplayString(g.value[k].entityRef),1),n.createElementVNode("label",Tx,[C[20]||(C[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":g.value[k].multiplicity,items:K,"value-provider":X,"label-provider":X,disabled:((V=T.value)==null?void 0:V.which)===k,"onUpdate:modelValue":ge=>B(k,{multiplicity:ge})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${k}-navigable`,class:"em-check",label:"navigable","model-value":g.value[k].navigable,"onUpdate:modelValue":ge=>B(k,{navigable:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${k}-composition`,class:"em-check",label:"composition","model-value":g.value[k].composition,"onUpdate:modelValue":ge=>B(k,{composition:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",Mx,[C[21]||(C[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(F,ge=>{var ve,Ee;return n.createVNode(n.unref(ae.BSCheckbox),{key:ge,name:`${k}-cascade-${ge}`,class:"em-check",label:ge,"model-value":!!((Ee=(ve=g.value[k].jpa)==null?void 0:ve.cascadeTypes)!=null&&Ee.includes(ge)),disabled:ge!=="ALL"&&v(k),"onUpdate:modelValue":w=>R(k,ge,w)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),v(k)?(n.openBlock(),n.createElementBlock("p",Bx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",Dx,[C[24]||(C[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",Ox,[C[22]||(C[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":P(k),items:G,"value-provider":X,"label-provider":Q,"onUpdate:modelValue":ge=>ge&&W(k,ge)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${k}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((H=g.value[k].jpa)!=null&&H.orphanRemoval),disabled:oe(k),"onUpdate:modelValue":ge=>E(k,{orphanRemoval:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),oe(k)&&((te=g.value[k].jpa)!=null&&te.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",Lx,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",Px,[C[23]||(C[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${k}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((ne=g.value[k].jpa)==null?void 0:ne.orderBy)??"","onUpdate:modelValue":ge=>E(k,{orderBy:ge.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",zx,[C[25]||(C[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,k=>{var V;return n.openBlock(),n.createElementBlock("label",{key:k,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(k),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${k}`,width:"100%","model-value":((V=_.value.name)==null?void 0:V[k])??"","onUpdate:modelValue":H=>me(k,H)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",Ux,[C[26]||(C[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:C[7]||(C[7]=k=>re({description:k.target.value}))},null,40,Hx)]),n.createElementVNode("label",Fx,[C[27]||(C[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":C[8]||(C[8]=k=>re({packageName:k}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":C[9]||(C[9]=k=>re({excludeDDLGeneration:k}))},null,8,["model-value"]),n.createElementVNode("fieldset",Gx,[C[28]||(C[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Yx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":be.value===null}]),title:"없음",onClick:C[10]||(C[10]=k=>xe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),k=>(n.openBlock(),n.createElementBlock("button",{key:k,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":be.value===k}]),style:n.normalizeStyle({background:n.unref(Dn)(k)}),title:n.unref(Bn)(k),onClick:V=>xe(k)},null,14,Wx))),128))])]),n.createElementVNode("p",Kx,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",qx,[C[29]||(C[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:C[11]||(C[11]=k=>Ce(k.target.value))},null,40,Xx)]),n.createElementVNode("fieldset",jx,[C[30]||(C[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Zx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:"없음",onClick:C[12]||(C[12]=k=>ye(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(mn),k=>(n.openBlock(),n.createElementBlock("button",{key:k,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Se.value===k}]),style:n.normalizeStyle({background:n.unref(Dn)(k)}),title:n.unref(Bn)(k),onClick:V=>ye(k)},null,14,Jx))),128))])])],64)):n.createCommentVNode("",!0)],8,$x)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),Qx={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function eI(e){const t=e.split("-")[1];return t?Qx[t]??t:e}function tI(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const nI=["title"],oI=["title","onClick"],iI={key:0,class:"em-validation__body"},aI={class:"em-validation__opt"},lI={key:0,class:"em-validation__empty"},rI={key:1,class:"em-validation__empty"},sI={key:2,class:"em-validation__list"},cI=["onClick"],dI={class:"em-validation__item-msg"},uI={key:0,class:"em-validation__item-entity"},fI=["title"],mI=Le(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const b=new Map;for(const g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function l(b){const g=tI(b);if(!g)return null;const _=a.value.get(g);return _===void 0?null:_.trim()===""?"(이름 없음)":_}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const b={error:0,warning:0,info:0};for(const g of i.value)b[g.severity]++;return b}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,g)=>r[b.severity].order-r[g.severity].order)),u=n.computed(()=>d.value.map(b=>({issue:b,entityName:l(b),category:eI(b.ruleId)}))),f=n.ref(!1);function p(b){c.value[b]=!c.value[b]}function m(b){if(!f.value){f.value=!0;return}p(b)}function h(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,g)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:g[1]||(g[1]=_=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),g[3]||(g[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,nI),n.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:N=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,oI)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",iI,[n.createElementVNode("label",aI,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",lI,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",rI," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",sI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:N,category:y},$)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${$}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:K=>h(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",dI,[N?(n.openBlock(),n.createElementBlock("span",uI,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(y),9,fI)],10,cI))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),pI={class:"em-history"},hI={class:"em-history__head"},yI={class:"em-history__title"},gI={class:"em-history__head-actions"},bI=["disabled"],_I={class:"em-history__filters"},wI={class:"em-history__filter"},vI={class:"em-history__body"},kI={key:0,class:"em-history__empty"},EI={key:1,class:"em-history__empty is-error"},NI={key:2,class:"em-history__empty"},$I={key:3,class:"em-history__list"},xI=["onClick"],II={class:"em-history__summary"},SI={class:"em-history__seq"},CI={class:"em-history__gmeta"},RI={class:"em-history__who"},VI={key:0,class:"em-history__time"},AI={key:1,class:"em-history__restored-from"},TI={key:0,class:"em-history__detail"},MI={class:"em-history__action-head"},BI={class:"em-history__action-name"},DI={key:0,class:"em-history__fields"},OI={class:"em-history__fname"},LI={key:0,class:"em-history__old"},PI={class:"em-history__val"},zI={key:1,class:"em-history__restore"},UI=["disabled","onClick"],HI=["disabled"],FI=["onClick"],GI=Le(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.ref([]),r=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){r.value=!0,s.value=null;try{l.value=await a.historyTransport(),c.value=!0}catch(T){s.value=T instanceof Error?T.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,T=>{T&&u()},{immediate:!0});let f=null;n.watch(()=>a.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const p=n.computed(()=>new Map(a.state.logical.entities.map(T=>[T.modelId,T]))),m=n.computed(()=>new Map(a.state.logical.associations.map(T=>[T.modelId,T]))),h=n.computed(()=>new Map((a.state.logical.groups??[]).map(T=>{var J;return[T.modelId,T.packageName||((J=T.name)==null?void 0:J.ko)||T.modelId]})));function b(T){var we,re,me,be,xe,Ce,Se;const J=m.value.get(T);if(!J)return"연관";if((we=J.description)!=null&&we.trim())return J.description.trim();const se=(be=(me=p.value.get((re=J.end1)==null?void 0:re.entityRef))==null?void 0:me.name)==null?void 0:be.trim(),he=(Se=(Ce=p.value.get((xe=J.end2)==null?void 0:xe.entityRef))==null?void 0:Ce.name)==null?void 0:Se.trim();return se&&he?`${se}→${he}`:"연관"}function g(T){var J,se,he,we;if(T.kind==="entity")return((se=(J=p.value.get(T.ref))==null?void 0:J.name)==null?void 0:se.trim())||"(이름 없음)";if(T.kind==="attribute"||T.kind==="operation"||T.kind==="index"){const re=T.entityRef?p.value.get(T.entityRef):void 0,be=((T.kind==="attribute"?re==null?void 0:re.attributes:T.kind==="operation"?re==null?void 0:re.operations:re==null?void 0:re.indexes)??[]).find(Ce=>Ce.modelId===T.ref),xe=(he=re==null?void 0:re.name)==null?void 0:he.trim();return`${xe?xe+".":""}${((we=be==null?void 0:be.name)==null?void 0:we.trim())||T.ref}`}return T.kind==="association"?b(T.ref):T.kind==="associationEnd"?`${b(T.ref)}(${T.end})`:T.kind==="group"?`그룹 ${h.value.get(T.ref)??T.ref}`:T.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),$=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],K=n.computed({get:()=>y.value,set:T=>{T&&(y.value=T)}}),F=n.computed(()=>rr(l.value)),q=n.computed(()=>F.value.length?F.value[0].seq:null),G=n.computed(()=>y.value==="all"?F.value:F.value.filter(T=>(T.kind??"edit")===y.value));function X(T){return T===void 0?"—":T===null?"(비움)":typeof T=="object"?JSON.stringify(T):String(T)}function Q(T){const J=g(T.subject);if(T.verb==="add")return`${J} 추가`;if(T.verb==="remove")return`${J} 삭제`;if(T.fields.length===1){const se=T.fields[0];return`${J}.${se.field} ${se.oldValue!==void 0?X(se.oldValue)+"→":""}${X(se.value)}`}return`${J} ${T.fields.length}개 변경`}function de(T){return T.actions.length===0?"변경 없음":T.actions.length===1?Q(T.actions[0]):`${Q(T.actions[0])} 외 ${T.actions.length-1}건`}const B=n.ref(new Set);function ee(T){const J=new Set(B.value);J.has(T)?J.delete(T):J.add(T),B.value=J}function v(T){if(T==null)return"";const J=new Date(T);return isNaN(J.getTime())?String(T):J.toLocaleString()}function R(T){const J=T.author,se=T.origin;return J&&se?`${J}(${se})`:J||(se?`(${se})`:"—")}const E=n.ref(null),P=n.ref(!1);function W(T){E.value=T}async function oe(T){P.value=!0;try{const J=await a.restoreToSeq(T);J.ok||(s.value=`복원 실패: ${J.reason??"알 수 없음"}`)}finally{P.value=!1,E.value=null}}return(T,J)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",pI,[n.createElementVNode("header",hI,[n.createElementVNode("div",yI,[n.createVNode(Ve,{name:"undo",size:15}),J[4]||(J[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",gI,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:J[0]||(J[0]=se=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,bI),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:J[1]||(J[1]=se=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",_I,[n.createElementVNode("label",wI,[J[5]||(J[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:K.value,"onUpdate:modelValue":J[2]||(J[2]=se=>K.value=se),items:$,"value-provider":se=>se.v,"label-provider":se=>se.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",vI,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",kI,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",EI,n.toDisplayString(s.value),1)):G.value.length===0?(n.openBlock(),n.createElementBlock("p",NI,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",$I,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(G.value,se=>(n.openBlock(),n.createElementBlock("li",{key:se.seq,class:n.normalizeClass(["em-history__group",[`is-${se.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:he=>ee(se.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":B.value.has(se.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${se.kind??"edit"}`])},n.toDisplayString(se.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",II,n.toDisplayString(de(se)),1),n.createElementVNode("span",SI,"#"+n.toDisplayString(se.seq),1)],8,xI),n.createElementVNode("div",CI,[n.createElementVNode("span",RI,n.toDisplayString(R(se)),1),se.ts?(n.openBlock(),n.createElementBlock("span",VI,n.toDisplayString(v(se.ts)),1)):n.createCommentVNode("",!0),se.kind==="restore"&&se.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",AI,"← #"+n.toDisplayString(se.restoredFromSeq),1)):n.createCommentVNode("",!0)]),B.value.has(se.seq)?(n.openBlock(),n.createElementBlock("div",TI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.actions,(he,we)=>(n.openBlock(),n.createElementBlock("div",{key:we,class:"em-history__action"},[n.createElementVNode("div",MI,[n.createVNode(Ve,{name:_[he.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",BI,n.toDisplayString(g(he.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${he.verb}`])},n.toDisplayString(N[he.verb]),3)]),he.fields.length?(n.openBlock(),n.createElementBlock("ul",DI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(he.fields,(re,me)=>(n.openBlock(),n.createElementBlock("li",{key:me,class:"em-history__field"},[n.createElementVNode("span",OI,n.toDisplayString(re.field),1),re.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",LI,n.toDisplayString(X(re.oldValue)),1)):n.createCommentVNode("",!0),re.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",PI,n.toDisplayString(X(re.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&se.seq!==q.value?(n.openBlock(),n.createElementBlock("div",zI,[E.value===se.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[J[6]||(J[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:P.value,onClick:he=>oe(se.seq)},"복원",8,UI),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:P.value,onClick:J[3]||(J[3]=he=>E.value=null)},"취소",8,HI)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:he=>W(se.seq)},[n.createVNode(Ve,{name:"undo",size:12}),J[7]||(J[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,FI))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function YI(e,t){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=t?i:null}function Ou(e){const t=n.ref(YI(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const l=a.clientX,r=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?l-d.clientX:d.clientX-l;let f=r+u;f=Math.max(e.min,f),e.max!=null&&(f=Math.min(e.max,f)),t.value=f},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const WI={class:"em-modeler"},KI={class:"em-modeler__body"},qI={class:"em-drawer__inner"},XI={class:"em-drawer__head"},jI={class:"em-drawer__actions"},ZI=["title"],JI=Le(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:l,startResize:r}=Ou({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Ou({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(p,m)=>{var h,b,g;return n.openBlock(),n.createElementBlock("div",WI,[n.createVNode(Bu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onToggleHistory:m[1]||(m[1]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",KI,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",qI,[n.createElementVNode("header",XI,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",jI,[(h=f.value)!=null&&h.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(b=f.value)!=null&&b.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=_=>{var N;return(N=f.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(g=f.value)!=null&&g.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,ZI)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Mu,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[4]||(m[4]=(..._)=>n.unref(r)&&n.unref(r)(..._))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[5]||(m[5]=_=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(Tu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Du,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[6]||(m[6]=_=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[7]||(m[7]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(GI,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(mI,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-dc519653"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=lm,Ne.AssociationEdge=Od,Ne.CUSTOM_TYPE_VALUE=Ot,Ne.CommandStack=ga,Ne.DEFAULT_JAVA_TYPE=da,Ne.DiagramCanvas=Tu,Ne.DiagramExplorer=Mu,Ne.EDITOR=hn,Ne.EditModeToggle=x$,Ne.EditorToolbar=Bu,Ne.EntityModeler=JI,Ne.EntityNode=vd,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=kd,Ne.JAVA_TYPES=ua,Ne.NoteNode=Ed,Ne.OpSyncAdapter=Kr,Ne.PHYSICAL_NAME_MAX_LENGTH=ma,Ne.PropertyPanel=Du,Ne.RevCache=Wr,Ne.SELECTABLE_JAVA_TYPES=Ql,Ne.SYMBOLIC_OP_KINDS=qr,Ne.SYMBOLIC_OP_SCHEMA=as,Ne.anchoredEdgePoint=la,Ne.buildAgentBatch=rm,Ne.buildDiagramSvg=Vu,Ne.buildOrthogonalPath=na,Ne.buildSelfLoopPath=Gl,Ne.buildStraightPath=ia,Ne.commands=Rf,Ne.computeAutoLayout=Yl,Ne.createEditorController=U_,Ne.displayLabel=Oo,Ne.emptyState=gd,Ne.entityModelToText=Xl,Ne.estimateEntityHeight=Kl,Ne.exportDiagramSvg=Au,Ne.fromPersisted=wm,Ne.indexColumnsByModelId=Wn,Ne.javaTypeLabel=vn,Ne.migrateLegacyMoney=uf,Ne.newId=Te,Ne.orthogonalMidpoints=oa,Ne.packEntityBoxes=Gu,Ne.physicalNameWarning=zo,Ne.projectActionLog=rr,Ne.projectEntityAudit=ar,Ne.projectFieldAudit=Lt,Ne.rectExitPoint=aa,Ne.renderDiagramSvg=Zl,Ne.resolveDiagram=Hl,Ne.resolveSharedColumn=Po,Ne.resolveSymbolicOps=jf,Ne.restoreDeepEqual=kn,Ne.segmentMidpoints=ra,Ne.sideDir=Gn,Ne.synthesizeRestoreOps=vf,Ne.toPersisted=Mm,Ne.toPersistedV2=Bm,Ne.validateModel=or,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));