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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/agent/symbolicOp.d.ts +1 -0
  2. package/dist/command/commands.d.ts +11 -3
  3. package/dist/core/attributeOrder.d.ts +17 -0
  4. package/dist/core/ddl.d.ts +10 -0
  5. package/dist/core/inheritedColumns.d.ts +57 -0
  6. package/dist/core/jsonModel.d.ts +23 -0
  7. package/dist/core/mergeDiagram.d.ts +45 -0
  8. package/dist/core/mermaid.d.ts +6 -0
  9. package/dist/core/parseMermaid.d.ts +9 -0
  10. package/dist/core/parseSqlDdl.d.ts +11 -0
  11. package/dist/core/propagation.d.ts +22 -0
  12. package/dist/core/quickFix.d.ts +12 -0
  13. package/dist/core/scaffoldJava.d.ts +62 -0
  14. package/dist/core/sharedColumn.d.ts +16 -1
  15. package/dist/core/text.d.ts +4 -1
  16. package/dist/core/types.d.ts +46 -0
  17. package/dist/core/validation.d.ts +37 -6
  18. package/dist/editor/controller.d.ts +88 -10
  19. package/dist/entity-modeler-next.css +1 -1
  20. package/dist/entity-modeler.js +13964 -10381
  21. package/dist/entity-modeler.umd.cjs +36 -15
  22. package/dist/i18n/en.d.ts +3 -0
  23. package/dist/i18n/index.d.ts +17 -0
  24. package/dist/i18n/ja.d.ts +3 -0
  25. package/dist/i18n/ko.d.ts +362 -0
  26. package/dist/index.d.ts +11 -1
  27. package/dist/view/CommandPalette.vue.d.ts +10 -0
  28. package/dist/view/DiagramCanvas.vue.d.ts +2 -0
  29. package/dist/view/EditModeToggle.vue.d.ts +3 -0
  30. package/dist/view/EditorToolbar.vue.d.ts +2 -0
  31. package/dist/view/EmContextMenu.vue.d.ts +7 -2
  32. package/dist/view/GroupCodeCombobox.vue.d.ts +2 -0
  33. package/dist/view/OperationSourceEditor.vue.d.ts +2 -0
  34. package/dist/view/{EntityTextPreview.vue.d.ts → ShortcutHelpModal.vue.d.ts} +2 -1
  35. package/dist/view/TextExportModal.vue.d.ts +15 -0
  36. package/dist/view/TextImportModal.vue.d.ts +8 -0
  37. package/dist/view/explorerFilter.d.ts +20 -0
  38. package/dist/view/exportImage.d.ts +14 -0
  39. package/dist/view/opConflictNotice.d.ts +12 -0
  40. package/dist/view/validationDisplay.d.ts +14 -2
  41. package/package.json +1 -1
  42. package/dist/view/exportSvg.d.ts +0 -7
@@ -1,10 +1,31 @@
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 QI=Object.defineProperty;var eS=(Ne,n,ae)=>n in Ne?QI(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Ne[n]=ae;var Fe=(Ne,n,ae)=>eS(Ne,typeof n!="symbol"?n+"":n,ae);const Ou={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Lu(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 Ul(e,t,o={}){const i={...Ou,...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=Lu(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 Hl(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 ta(e,t,o,i,a,l=20){const r=Hl(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 Pu=14;function na(e,t,o,i,a,l=20){return Hl(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=Pu).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 zu=36;function Fl(e,t,o=zu){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 oa(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 Uu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ia(e,t){const o=Uu(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 aa(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 la(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 Hu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Gl(e,t,o={}){const i={...Hu,...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 Yl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Wl(e,t={}){const o={...Yl,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Fu(e,t={}){const o={...Yl,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=Wl(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 Kl(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 ql(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} ${Kl(c.end1.multiplicity)} —— ${Kl(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
- `).trim()}const Gu=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function at(e){return e.replace(Gu,"").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 Xl(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 Yu(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 Wu(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 Ku(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 ra(e){const t=Wu(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="${Ku(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(Yu(r));for(const r of e.texts)l.push(Xl(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function qu(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(Xl(i));return`<g>${o.join("")}</g>`}function jl(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(ra(r));for(const r of e.edges)l.push(qu(r));for(const r of e.entities)l.push(ra(r));for(const r of e.notes)l.push(ra(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 Xu=["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"],ju=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"]),Zu=Xu.filter(e=>!ju.has(e)),Ju={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function sa(e){return Ju[e]??e}const Qu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Lo=new Set(["NUMERIC","DECIMAL"]);function Zl(e,t=Zu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ot="CustomType",Yn="GroupCodeEnum",ca="String",da=[{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"}],ef=new Map(da.map(e=>[e.value,e.label]));function vn(e){return ef.get(e)??e}const tf=new Set([Yn,"CustomMoneyType"]),Jl=da.filter(e=>!tf.has(e.value)).map(e=>e.value===Ot?{...e,label:"CustomType (사용자정의)"}:e);function Ql(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=[...Jl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:vn(e)},...i]:i}function nf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function er(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 ua(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${vn(t.type)}>`:nf(t)?vn(t.type):e==="CLASS"?t.type===Ot&&t.customType||vn(t.type):sa(((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 fa=63;function zo(e){if(!e)return null;const t=e.length;return t<=fa?null:`물리명이 ${fa}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function tr(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 of(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 af(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 ma(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 nr(e,t){var l,r,s;const o=[];for(const c of ma(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 ma(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:af(h,b,g,e,t)})).filter(b=>b.col.sharedColumnRef==null));for(const h of ma(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)&&Qu.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:`공유 대상 컬럼의 타입(${tr($)})이 ${y.name??"컬럼"} 정의(${tr(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 of(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 lf="CustomMoneyType",rf="Money";function sf(e){return!(e.type!==lf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function cf(e){const t=e.dbAttrs[0]??{modelId:Te(),physicalName:"",dataType:""},o={modelId:Te(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:rf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function df(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>sf(r)?(a=!0,t=!0,cf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function pa(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 uf(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 ff=new Set(["attributes","operations","indexes","rev"]),mf=new Set(["end1","end2","rev"]),pf=new Set(["memberEntityRefs","rev"]),or=new Set(["modelId"]),hf=new Set(["modelId","columns"]),yf=new Set([]);function gf(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,or);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,or);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,hf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function bf(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:pa(r)});for(const{cur:r,tgt:s}of i.common){const c=Jt(r,s,ff);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),gf(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:pa(r)});for(const{cur:r,tgt:s}of a.common){const c=Jt(r,s,mf);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]??{},yf);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:pa(r)});for(const{cur:r,tgt:s}of l.common){const c=Jt(r,s,pf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=uf(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 _f(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 wf(e,t){const o=[];return bf(e.logical,t.logical,o),_f(e.layout,t.layout,o),o}function vf(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 kf={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 Ef{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=kf[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 ha(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=vf(t),i=new Ef(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=ha((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=ha((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=ha((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 Nf(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 $f(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 ir(e,t){const o=e.filter(s=>s.ops.some(c=>Nf(c,t))),{attributes:i,operations:a,indexes:l}=$f(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 ar(e){return`${e.kind}:${e.ref}:${e.end??""}`}function xf(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 If(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 Sf(e){const{entities:t,associations:o,groups:i}=If(e),a=[];for(const l of t)for(const r of ir(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 lr(e){const t=Sf(e),o=xf(e),i=new Map;for(const r of t){const s=ar(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=ar(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 ya{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 rr(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 ga(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=rr(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 ba(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=rr(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 sr(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 cr(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 dr(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 ur(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 fr(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 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.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 _a(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 wa(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 pr(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 va(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 hr(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 yr(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 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.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 br(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 _r(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 ka(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 wr(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 vr(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 kr(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 Er(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 Nr(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 Ea(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 Na(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 $r(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 xr(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 Ir(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 Sr(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 Cr(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 Rr(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 Vr(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 Ar(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 Tr(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 $a(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 Mr(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 Br(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 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.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 Or(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 Lr(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 Pr(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 zr(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 Ur(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 Hr(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 Fr(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 Gr(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 Cf=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:It,addEntity:ga,addEntityToGroup:hr,addGroup:wa,addIndex:$r,addNote:Tr,addNoteConnection:Pr,addNoteConnectionWaypoint:Hr,addNoteToGroup:Or,addOperation:wr,addWaypoint:Ar,clearNoteConnectionWaypoints:Gr,clearWaypoints:Vr,composite:ze,moveEntity:Nn,moveGroup:yr,moveNote:Zn,moveNoteConnectionWaypoint:Ur,moveWaypoint:Sr,removeAssociation:Na,removeAttribute:Pt,removeEntity:ba,removeEntityFromGroup:Go,removeGroup:va,removeIndex:Ir,removeNote:$a,removeNoteConnection:zr,removeNoteConnectionWaypoint:Fr,removeNoteFromGroup:Lr,removeOperation:kr,removeWaypoint:Cr,renameEntity:cr,reorderAttributes:ka,reorderOperations:Er,resizeEntity:dr,resizeGroup:gr,resizeNote:Mr,setAllEntitiesCollapsed:_a,setAttributeSwatch:Fo,setEntityCollapsed:fr,setEntityLocked:mr,setEntitySwatch:ur,setGroupLocked:_r,setGroupSwatch:br,setNoteMemo:Br,setNoteSwatch:Dr,setOperationSwatch:Nr,translateWaypoints:Rr,updateAssociation:Yo,updateAssociationEnd:$n,updateAttribute:tn,updateEntity:sr,updateGroup:pr,updateIndex:xr,updateOperation:vr},Symbol.toStringTag,{value:"Module"}));class Yr{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 Wr{constructor(t){Fe(this,"cache",new Yr);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 Kr=["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"],qr=()=>crypto.randomUUID(),Rf=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Vf=e=>e&&e[0].toLowerCase()+e.slice(1),Af=e=>e&&e[0].toUpperCase()+e.slice(1),Tf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Mf(e,t){return Vf(e)+Af(t)}function Bf(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=Mf(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:Tf(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Ko=(e,t)=>`${e}::${t}`;function Df(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||s.length!==l.length||s.scale!==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 Of(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=qr){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=>Bf(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(Of(f,u++,o));else{const h=Df(m,f,o);h&&i.update.push({attributeId:m.modelId,patch:h})}}return i}function Lf(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 Pf(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function zf(e,t,o=qr){const i=new Map,a=Pf(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(Rf(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(p=>p.modelId===d);f&&Lf(f,u),l.has(d)||r.push(d)}}return i}function Uf(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 Hf(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 Xr(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=Uf(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 Ff(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=()=>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 jr(e,t){const o=Gf(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){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Wf(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Kf(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 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 Zr(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 Jr(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=jr(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 Qr(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 es(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=jr(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 Xf(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=Jr(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(Zr(q,F,i))}const $=(f.spec.operations??[]).map((F,q)=>Qr(F,q,i));$.length&&(_.operations=$);const K=[];for(const F of f.spec.indexes??[]){const q=es(_,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=Jr(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=Zr(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 _=Ff(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=Xr(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=ts(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=ts(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 _=es(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 _=Kf(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=Qr(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 _=qf(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 ts(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=Xr(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 ns={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},jf={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Zf={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},qo={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Jf={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:{...qo,description:"속성 설명(다국어)."},columnLogicalName:{...qo,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},os={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Qf={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...os,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...os,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},em={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ns,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},tm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...qo,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},nm={type:"object",properties:{name:{...qo,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},om={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function Ze(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const im={"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"]})},is={anyOf:Kr.map(e=>im[e])},am={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ns,assocHandle:jf,entitySpec:Zf,attrSpec:Jf,assocSpec:Qf,indexSpec:em,operationSpec:tm,groupSpec:nm,patch:om,symbolicOp:is}};function lm(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 as={location:{x:0,y:0},size:{width:220,height:140}};function ls(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 rm=/^[-=_*~\s]{3,}$/;function sm(e){return e.attrType&&e.attrType!=="NORMAL"||!rm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function cm(e,t){return e.attrType==="DIVIDER"||sm(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(ls)}}function dm(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 um(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 fm(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(cm),operations:(t=e.operations)==null?void 0:t.map(dm),indexes:(o=e.indexes)==null?void 0:o.map(um),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function mm(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??{...as},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 rs(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 xa(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:rs(e)}}function pm(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:xa(e.end1),end2:xa(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 ss(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function cs(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ds(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 us(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(ls)}}function hm(e,t,o){var g,_;const i=ss(e.end1.attribute),a=ss(e.end2.attribute);if(i===a)return pm(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={...us(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:rs(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 ym(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 gm(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={...us(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>ym(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...xa(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 bm(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 fs(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=bm(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 _m(e){return(e.schemaVersion??1)>=2&&"logical"in e?wm(e):vm(e)}function wm(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 vm(e){var _,N;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,$)=>{o.push(fm(y));const K=mm(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(fs(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 $=cs(y.end1.attribute),K=cs(y.end2.attribute),F=ds(y.end1)||ds(y.end2),{assoc:q,layout:G}=$!==K||F?gm(y,p,h):hm(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=>fs(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 ms(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 km(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(ms),style:t}}function Em(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 Nm(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 $m(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{...ms(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function xm(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 Im(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 Sm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function Cm(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:Sm(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 Rm(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)=>Cm(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 Vm(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=Rm(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?$m(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 ps(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)??{...as},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 km(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 Em(p,(m=l==null?void 0:l.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>Vm(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Nm),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 Am(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=>hs(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>ps(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 hs(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 Tm(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=xm(e),l=Im(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=>ps(s,e,a,l)),groups:e.logical.groups.map(s=>Am(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>hs(s))}}function Mm(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 Bm=typeof window<"u"&&typeof document<"u",Dm=e=>typeof e<"u",Om=Object.prototype.toString,Lm=e=>Om.call(e)==="[object Object]",Pm=()=>{};function zm(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 ys=e=>e();function Um(e=ys){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 gs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Hm(e,t,o={}){const{eventFilter:i=ys,...a}=o;return n.watch(e,zm(i,t),a)}function xn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=Um(i);return{stop:Hm(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Fm(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 Ia(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(gs(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(gs(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 Ia(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Ia(e,!t)}}}function Sa(e){return Ia(e)}function Gm(e){var t;const o=St(e);return(t=o==null?void 0:o.$el)!=null?t:o}const bs=Bm?window:void 0;function _s(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=bs):[t,o,i,a]=e,!t)return Pm;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(()=>[Gm(t),St(a)],([u,f])=>{if(r(),!u)return;const p=Lm(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 Ym(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function ws(...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=bs,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Ym(t);return _s(a,l,u=>{u.repeat&&St(s)||c(u)&&o(u)},r)}function Wm(e){return JSON.parse(JSON.stringify(e))}function Ca(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):Wm(y):y,_=()=>Dm(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 Km={value:()=>{}};function Xo(){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 jo(o)}function jo(e){this._=e}function qm(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}})}jo.prototype=Xo.prototype={constructor:jo,on:function(e,t){var o=this._,i=qm(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Xm(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]=vs(o[a],e.name,t);else if(t==null)for(a in o)o[a]=vs(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 jo(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 Xm(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function vs(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Km,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ra="http://www.w3.org/1999/xhtml";const ks={svg:"http://www.w3.org/2000/svg",xhtml:Ra,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zo(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ks.hasOwnProperty(t)?{space:ks[t],local:e}:e}function jm(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ra&&t.documentElement.namespaceURI===Ra?t.createElement(e):t.createElementNS(o,e)}}function Zm(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Es(e){var t=Zo(e);return(t.local?Zm:jm)(t)}function Jm(){}function Va(e){return e==null?Jm:function(){return this.querySelector(e)}}function Qm(e){typeof e!="function"&&(e=Va(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 ep(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function tp(){return[]}function Ns(e){return e==null?tp:function(){return this.querySelectorAll(e)}}function np(e){return function(){return ep(e.apply(this,arguments))}}function op(e){typeof e=="function"?e=np(e):e=Ns(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 $s(e){return function(){return this.matches(e)}}function xs(e){return function(t){return t.matches(e)}}var ip=Array.prototype.find;function ap(e){return function(){return ip.call(this.children,e)}}function lp(){return this.firstElementChild}function rp(e){return this.select(e==null?lp:ap(typeof e=="function"?e:xs(e)))}var sp=Array.prototype.filter;function cp(){return Array.from(this.children)}function dp(e){return function(){return sp.call(this.children,e)}}function up(e){return this.selectAll(e==null?cp:dp(typeof e=="function"?e:xs(e)))}function fp(e){typeof e!="function"&&(e=$s(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 Is(e){return new Array(e.length)}function mp(){return new lt(this._enter||this._groups.map(Is),this._parents)}function Jo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Jo.prototype={constructor:Jo,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 pp(e){return function(){return e}}function hp(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 Jo(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function yp(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 Jo(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function gp(e){return e.__data__}function bp(e,t){if(!arguments.length)return Array.from(this,gp);var o=t?yp:hp,i=this._parents,a=this._groups;typeof e!="function"&&(e=pp(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=_p(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 _p(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wp(){return new lt(this._exit||this._groups.map(Is),this._parents)}function vp(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 kp(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 Ep(){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 Np(e){e||(e=$p);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 $p(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ip(){return Array.from(this)}function Sp(){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 Cp(){let e=0;for(const t of this)++e;return e}function Rp(){return!this.node()}function Vp(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 Ap(e){return function(){this.removeAttribute(e)}}function Tp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Mp(e,t){return function(){this.setAttribute(e,t)}}function Bp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Dp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Op(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 Lp(e,t){var o=Zo(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?Tp:Ap:typeof t=="function"?o.local?Op:Dp:o.local?Bp:Mp)(o,t))}function Ss(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Pp(e){return function(){this.style.removeProperty(e)}}function zp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Up(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Hp(e,t,o){return arguments.length>1?this.each((t==null?Pp:typeof t=="function"?Up:zp)(e,t,o??"")):In(this.node(),e)}function In(e,t){return e.style.getPropertyValue(t)||Ss(e).getComputedStyle(e,null).getPropertyValue(t)}function Fp(e){return function(){delete this[e]}}function Gp(e,t){return function(){this[e]=t}}function Yp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Wp(e,t){return arguments.length>1?this.each((t==null?Fp:typeof t=="function"?Yp:Gp)(e,t)):this.node()[e]}function Cs(e){return e.trim().split(/^|\s+/)}function Aa(e){return e.classList||new Rs(e)}function Rs(e){this._node=e,this._names=Cs(e.getAttribute("class")||"")}Rs.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 Vs(e,t){for(var o=Aa(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function As(e,t){for(var o=Aa(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Kp(e){return function(){Vs(this,e)}}function qp(e){return function(){As(this,e)}}function Xp(e,t){return function(){(t.apply(this,arguments)?Vs:As)(this,e)}}function jp(e,t){var o=Cs(e+"");if(arguments.length<2){for(var i=Aa(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Xp:t?Kp:qp)(o,t))}function Zp(){this.textContent=""}function Jp(e){return function(){this.textContent=e}}function Qp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function eh(e){return arguments.length?this.each(e==null?Zp:(typeof e=="function"?Qp:Jp)(e)):this.node().textContent}function th(){this.innerHTML=""}function nh(e){return function(){this.innerHTML=e}}function oh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ih(e){return arguments.length?this.each(e==null?th:(typeof e=="function"?oh:nh)(e)):this.node().innerHTML}function ah(){this.nextSibling&&this.parentNode.appendChild(this)}function lh(){return this.each(ah)}function rh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sh(){return this.each(rh)}function ch(e){var t=typeof e=="function"?e:Es(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function dh(){return null}function uh(e,t){var o=typeof e=="function"?e:Es(e),i=t==null?dh:typeof t=="function"?t:Va(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function fh(){var e=this.parentNode;e&&e.removeChild(this)}function mh(){return this.each(fh)}function ph(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yh(e){return this.select(e?hh:ph)}function gh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function bh(e){return function(t){e.call(this,t,this.__data__)}}function _h(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 wh(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 vh(e,t,o){return function(){var i=this.__on,a,l=bh(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 kh(e,t,o){var i=_h(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?vh:wh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Ts(e,t,o){var i=Ss(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 Eh(e,t){return function(){return Ts(this,e,t)}}function Nh(e,t){return function(){return Ts(this,e,t.apply(this,arguments))}}function $h(e,t){return this.each((typeof t=="function"?Nh:Eh)(e,t))}function*xh(){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 Ms=[null];function lt(e,t){this._groups=e,this._parents=t}function eo(){return new lt([[document.documentElement]],Ms)}function Ih(){return this}lt.prototype=eo.prototype={constructor:lt,select:Qm,selectAll:op,selectChild:rp,selectChildren:up,filter:fp,data:bp,enter:mp,exit:wp,join:vp,merge:kp,selection:Ih,order:Ep,sort:Np,call:xp,nodes:Ip,node:Sp,size:Cp,empty:Rp,each:Vp,attr:Lp,style:Hp,property:Wp,classed:jp,text:eh,html:ih,raise:lh,lower:sh,append:ch,insert:uh,remove:mh,clone:yh,datum:gh,on:kh,dispatch:$h,[Symbol.iterator]:xh};function ut(e){return typeof e=="string"?new lt([[document.querySelector(e)]],[document.documentElement]):new lt([[e]],Ms)}function Sh(e){let t;for(;t=e.sourceEvent;)e=t;return e}function bt(e,t){if(e=Sh(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 Ch={passive:!1},to={capture:!0,passive:!1};function Ta(e){e.stopImmediatePropagation()}function Sn(e){e.preventDefault(),e.stopImmediatePropagation()}function Bs(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 Ds(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 Qo=e=>()=>e;function Ma(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}})}Ma.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rh(e){return!e.ctrlKey&&!e.button}function Vh(){return this.parentNode}function Ah(e,t){return t??{x:e.x,y:e.y}}function Th(){return navigator.maxTouchPoints||"ontouchstart"in this}function Mh(){var e=Rh,t=Vh,o=Ah,i=Th,a={},l=Xo("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",_,Ch).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),Bs($.view),Ta($),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),Ds($.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]))&&(Ta($),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])&&(Ta($),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 Ma("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 Ma(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"?$:Qo(!!$),p):e},p.container=function($){return arguments.length?(t=typeof $=="function"?$:Qo($),p):t},p.subject=function($){return arguments.length?(o=typeof $=="function"?$:Qo($),p):o},p.touchable=function($){return arguments.length?(i=typeof $=="function"?$:Qo(!!$),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 Ba(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Os(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function no(){}var oo=.7,ei=1/oo,Cn="\\s*([+-]?\\d+)\\s*",io="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Bh=/^#([0-9a-f]{3,8})$/,Dh=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),Oh=new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`),Lh=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${io}\\)$`),Ph=new RegExp(`^rgba\\(${_t},${_t},${_t},${io}\\)$`),zh=new RegExp(`^hsl\\(${io},${_t},${_t}\\)$`),Uh=new RegExp(`^hsla\\(${io},${_t},${_t},${io}\\)$`),Ls={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};Ba(no,nn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ps,formatHex:Ps,formatHex8:Hh,formatHsl:Fh,formatRgb:zs,toString:zs});function Ps(){return this.rgb().formatHex()}function Hh(){return this.rgb().formatHex8()}function Fh(){return Ys(this).formatHsl()}function zs(){return this.rgb().formatRgb()}function nn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Bh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Us(t):o===3?new ot(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ti(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ti(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=Dh.exec(e))?new ot(t[1],t[2],t[3],1):(t=Oh.exec(e))?new ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Lh.exec(e))?ti(t[1],t[2],t[3],t[4]):(t=Ph.exec(e))?ti(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zh.exec(e))?Gs(t[1],t[2]/100,t[3]/100,1):(t=Uh.exec(e))?Gs(t[1],t[2]/100,t[3]/100,t[4]):Ls.hasOwnProperty(e)?Us(Ls[e]):e==="transparent"?new ot(NaN,NaN,NaN,0):null}function Us(e){return new ot(e>>16&255,e>>8&255,e&255,1)}function ti(e,t,o,i){return i<=0&&(e=t=o=NaN),new ot(e,t,o,i)}function Gh(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 Da(e,t,o,i){return arguments.length===1?Gh(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}Ba(ot,Da,Os(no,{brighter(e){return e=e==null?ei:Math.pow(ei,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),ni(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:Hs,formatHex:Hs,formatHex8:Yh,formatRgb:Fs,toString:Fs}));function Hs(){return`#${an(this.r)}${an(this.g)}${an(this.b)}`}function Yh(){return`#${an(this.r)}${an(this.g)}${an(this.b)}${an((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fs(){const e=ni(this.opacity);return`${e===1?"rgb(":"rgba("}${on(this.r)}, ${on(this.g)}, ${on(this.b)}${e===1?")":`, ${e})`}`}function ni(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 Gs(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 Ys(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 Wh(e,t,o,i){return arguments.length===1?Ys(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}Ba(ft,Wh,Os(no,{brighter(e){return e=e==null?ei:Math.pow(ei,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(Oa(e>=240?e-240:e+120,a,i),Oa(e,a,i),Oa(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ft(Ws(this.h),oi(this.s),oi(this.l),ni(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=ni(this.opacity);return`${e===1?"hsl(":"hsla("}${Ws(this.h)}, ${oi(this.s)*100}%, ${oi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ws(e){return e=(e||0)%360,e<0?e+360:e}function oi(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 La=e=>()=>e;function Kh(e,t){return function(o){return e+o*t}}function qh(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 Xh(e){return(e=+e)==1?Ks:function(t,o){return o-t?qh(t,o,e):La(isNaN(t)?o:t)}}function Ks(e,t){var o=t-e;return o?Kh(e,o):La(isNaN(e)?t:e)}const ii=(function e(t){var o=Xh(t);function i(a,l){var r=o((a=Da(a)).r,(l=Da(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Ks(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 jh(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 Zh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Jh(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 Qh(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 ey(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 Pa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,za=new RegExp(Pa.source,"g");function ty(e){return function(){return e}}function ny(e){return function(t){return e(t)+""}}function qs(e,t){var o=Pa.lastIndex=za.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Pa.exec(e))&&(a=za.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=za.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?ny(c[0].x):ty(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"?La(t):(o==="number"?wt:o==="string"?(i=nn(t))?(t=i,ii):qs:t instanceof nn?ii:t instanceof Date?Qh:Zh(t)?jh:Array.isArray(t)?Jh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ey:wt)(e,t)}var Xs=180/Math.PI,Ua={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function js(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)*Xs,skewX:Math.atan(c)*Xs,scaleX:r,scaleY:s}}var ai;function oy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ua:js(t.a,t.b,t.c,t.d,t.e,t.f)}function iy(e){return e==null||(ai||(ai=document.createElementNS("http://www.w3.org/2000/svg","g")),ai.setAttribute("transform",e),!(e=ai.transform.baseVal.consolidate()))?Ua:(e=e.matrix,js(e.a,e.b,e.c,e.d,e.e,e.f))}function Zs(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 ay=Zs(oy,"px, ","px)","deg)"),ly=Zs(iy,", ",")",")"),ry=1e-12;function Js(e){return((e=Math.exp(e))+1/e)/2}function sy(e){return((e=Math.exp(e))-1/e)/2}function cy(e){return((e=Math.exp(2*e))-1)/(e+1)}const li=(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<ry)_=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=Js(K),Q=d/(o*N)*(X*cy(t*G+K)-sy(K));return[s+Q*m,c+Q*h,d*X/Js(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,Qs=1e3,ri,so,si=0,ln=0,ci=0,co=typeof performance=="object"&&performance.now?performance:Date,ec=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ha(){return ln||(ec(dy),ln=co.now()+ci)}function dy(){ln=0}function di(){this._call=this._time=this._next=null}di.prototype=tc.prototype={constructor:di,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ha():+o)+(t==null?0:+t),!this._next&&so!==this&&(so?so._next=this:ri=this,so=this),this._call=e,this._time=o,Fa()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fa())}};function tc(e,t,o){var i=new di;return i.restart(e,t,o),i}function uy(){Ha(),++Rn;for(var e=ri,t;e;)(t=ln-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rn}function nc(){ln=(si=co.now())+ci,Rn=lo=0;try{uy()}finally{Rn=0,my(),ln=0}}function fy(){var e=co.now(),t=e-si;t>Qs&&(ci-=t,si=e)}function my(){for(var e,t=ri,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:ri=o);so=e,Fa(i)}function Fa(e){if(!Rn){lo&&(lo=clearTimeout(lo));var t=e-ln;t>24?(e<1/0&&(lo=setTimeout(nc,e-co.now()-ci)),ro&&(ro=clearInterval(ro))):(ro||(si=co.now(),ro=setInterval(fy,Qs)),Rn=1,ec(nc))}}function oc(e,t,o){var i=new di;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var py=Xo("start","end","cancel","interrupt"),hy=[],ic=0,ac=1,Ga=2,ui=3,lc=4,Ya=5,fi=6;function mi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;yy(e,o,{name:t,index:i,group:a,on:py,tween:hy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ic})}function Wa(e,t){var o=mt(e,t);if(o.state>ic)throw new Error("too late; already scheduled");return o}function vt(e,t){var o=mt(e,t);if(o.state>ui)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 yy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=tc(l,0,o.time);function l(d){o.state=ac,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!==ac)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ui)return oc(r);m.state===lc?(m.state=fi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=fi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(oc(function(){o.state===ui&&(o.state=lc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ga,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ga){for(o.state=ui,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=Ya,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Ya&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=fi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function pi(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>Ga&&i.state<Ya,i.state=fi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function gy(e){return this.each(function(){pi(this,e)})}function by(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 _y(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 wy(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?by:_y)(o,e,t))}function Ka(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 rc(e,t){var o;return(typeof t=="number"?wt:t instanceof nn?ii:(o=nn(t))?(t=o,ii):qs)(e,t)}function vy(e){return function(){this.removeAttribute(e)}}function ky(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ey(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 Ny(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 $y(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 xy(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 Iy(e,t){var o=Zo(e),i=o==="transform"?ly:rc;return this.attrTween(e,typeof t=="function"?(o.local?xy:$y)(o,i,Ka(this,"attr."+e,t)):t==null?(o.local?ky:vy)(o):(o.local?Ny:Ey)(o,i,t))}function Sy(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Cy(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Ry(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 Vy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Sy(e,l)),o}return a._value=t,a}function Ay(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=Zo(e);return this.tween(o,(i.local?Ry:Vy)(i,t))}function Ty(e,t){return function(){Wa(this,e).delay=+t.apply(this,arguments)}}function My(e,t){return t=+t,function(){Wa(this,e).delay=t}}function By(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ty:My)(t,e)):mt(this.node(),t).delay}function Dy(e,t){return function(){vt(this,e).duration=+t.apply(this,arguments)}}function Oy(e,t){return t=+t,function(){vt(this,e).duration=t}}function Ly(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Dy:Oy)(t,e)):mt(this.node(),t).duration}function Py(e,t){if(typeof t!="function")throw new Error;return function(){vt(this,e).ease=t}}function zy(e){var t=this._id;return arguments.length?this.each(Py(t,e)):mt(this.node(),t).ease}function Uy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;vt(this,e).ease=o}}function Hy(e){if(typeof e!="function")throw new Error;return this.each(Uy(this._id,e))}function Fy(e){typeof e!="function"&&(e=$s(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 Gy(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 Yy(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 Wy(e,t,o){var i,a,l=Yy(t)?Wa:vt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Ky(e,t){var o=this._id;return arguments.length<2?mt(this.node(),o).on.on(e):this.each(Wy(o,e,t))}function qy(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Xy(){return this.on("end.remove",qy(this._id))}function jy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Va(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,mi(d[p],t,o,p,d,mt(u,o)));return new Ct(l,this._parents,t,o)}function Zy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Ns(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])&&mi(m,t,o,b,p,h);l.push(p),r.push(u)}return new Ct(l,r,t,o)}var Jy=eo.prototype.constructor;function Qy(){return new Jy(this._groups,this._parents)}function eg(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 sc(e){return function(){this.style.removeProperty(e)}}function tg(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 ng(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 og(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=sc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function ig(e,t,o){var i=(e+="")=="transform"?ay:rc;return t==null?this.styleTween(e,eg(e,i)).on("end.style."+e,sc(e)):typeof t=="function"?this.styleTween(e,ng(e,i,Ka(this,"style."+e,t))).each(og(this._id,e)):this.styleTween(e,tg(e,i,t),o).on("end.style."+e,null)}function ag(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function lg(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&ag(e,r,o)),i}return l._value=t,l}function rg(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,lg(e,t,o??""))}function sg(e){return function(){this.textContent=e}}function cg(e){return function(){var t=e(this);this.textContent=t??""}}function dg(e){return this.tween("text",typeof e=="function"?cg(Ka(this,"text",e)):sg(e==null?"":e+""))}function ug(e){return function(t){this.textContent=e.call(this,t)}}function fg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&ug(a)),t}return i._value=e,i}function mg(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,fg(e))}function pg(){for(var e=this._name,t=this._id,o=cc(),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);mi(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 hg(){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 yg=0;function Ct(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function cc(){return++yg}var Rt=eo.prototype;Ct.prototype={constructor:Ct,select:jy,selectAll:Zy,selectChild:Rt.selectChild,selectChildren:Rt.selectChildren,filter:Fy,merge:Gy,selection:Qy,transition:pg,call:Rt.call,nodes:Rt.nodes,node:Rt.node,size:Rt.size,empty:Rt.empty,each:Rt.each,on:Ky,attr:Iy,attrTween:Ay,style:ig,styleTween:rg,text:dg,textTween:mg,remove:Xy,tween:wy,delay:By,duration:Ly,ease:zy,easeVarying:Hy,end:hg,[Symbol.iterator]:Rt[Symbol.iterator]};function gg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bg={time:null,delay:0,duration:250,ease:gg};function _g(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 wg(e){var t,o;e instanceof Ct?(t=e._id,e=e._name):(t=cc(),(o=bg).time=Ha(),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])&&mi(c,e,t,d,r,o||_g(c,t));return new Ct(i,this._parents,e,t)}eo.prototype.interrupt=gy,eo.prototype.transition=wg;const hi=e=>()=>e;function vg(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 qa(e){e.stopImmediatePropagation()}function uo(e){e.preventDefault(),e.stopImmediatePropagation()}function kg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Eg(){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 dc(){return this.__zoom||Vn}function Ng(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $g(){return navigator.maxTouchPoints||"ontouchstart"in this}function xg(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 Ig(){var e=kg,t=Eg,o=xg,i=Ng,a=$g,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=li,d=Xo("start","zoom","end"),u,f,p,m=500,h=150,b=0,g=10;function _(v){v.property("__zoom",dc).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",dc),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 vg(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)],pi(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;Bs(v.view),qa(v),P.mouse=[oe,this.__zoom.invert(oe)],pi(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),Ds(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(qa(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)),pi(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(qa(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:hi(+v),_):i},_.filter=function(v){return arguments.length?(e=typeof v=="function"?v:hi(!!v),_):e},_.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:hi(!!v),_):a},_.extent=function(v){return arguments.length?(t=typeof v=="function"?v:hi([[+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||{}),Xa=(e=>(e.Partial="partial",e.Full="full",e))(Xa||{}),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||{}),ja=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ja||{}),fo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(fo||{}),uc=(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))(uc||{});const Sg=["INPUT","SELECT","TEXTAREA"],Cg=typeof document<"u"?document:null;function Za(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 Sg.includes(i==null?void 0:i.nodeName)||a||!!l}function Rg(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function fc(e,t,o,i){const a=t.replace("+",`
1
+ (function(_e,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):(_e=typeof globalThis<"u"?globalThis:_e||self,n(_e.EntityModeler={},_e.Vue,_e.OpenBlueseaCore))})(this,(function(_e,n,oe){"use strict";var IT=Object.defineProperty;var CT=(_e,n,oe)=>n in _e?IT(_e,n,{enumerable:!0,configurable:!0,writable:!0,value:oe}):_e[n]=oe;var qe=(_e,n,oe)=>CT(_e,typeof n!="symbol"?n+"":n,oe);const vf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function xf(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 Vl(e,t,o={}){const i={...vf,...o},a=new Map(e.entities.map(h=>[h.modelId,h])),r=new Map(e.associations.map(h=>[h.modelId,h])),l=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=>!a.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!r.has(h)),u=new Map;for(const h of e.groups)for(const k of h.memberEntityRefs)u.set(k,h.modelId);const m=new Map;for(const h of t.groupLayouts)for(const k of h.memberNoteRefs??[])m.set(k,h.groupRef);let f=0;const p=e.entities.map(h=>{const k=u.get(h.modelId),P=l.get(h.modelId);if(P){const G={location:{x:P.geo.location.x,y:P.geo.location.y},size:{width:P.geo.size.width,height:P.geo.size.height}};return{entity:h,geo:G,collapsed:P.collapsed??!1,locked:P.locked??!1,groupRef:k,style:P.style,attributeStyles:P.attributeStyles,operationStyles:P.operationStyles}}const A=xf(f++,i);return{entity:h,geo:A,collapsed:!1,locked:!1,groupRef:k}}),y=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),g=e.groups.map(h=>{const k=y.get(h.modelId),P=k?{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:P,style:k==null?void 0:k.style,locked:(k==null?void 0:k.locked)??!1}}),_=e.associations.map(h=>{const k=s.get(h.modelId);return{association:h,waypoints:(k==null?void 0:k.waypoints)??[],sourceColumnRef:k==null?void 0:k.sourceColumnRef,targetColumnRef:k==null?void 0:k.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:m.get(h.modelId)})),N=[];for(const h of t.notes)for(const k of h.connections??[])a.has(k.targetRef)&&N.push({noteRef:h.modelId,targetRef:k.targetRef,waypoints:k.waypoints.map(P=>({x:P.x,y:P.y}))});return{entities:p,associations:_,groups:g,notes:b,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function ho(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const Dn=.5;function Ml(e,t,o,i,a,r){const l=ho(t),s=ho(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let f=e;const p=(_,b)=>{(Math.abs(_.x-f.x)>=Dn||Math.abs(_.y-f.y)>=Dn)&&(m.push({a:f,b:_,seg:b}),f=_)};p(c,0);let y=l.x!==0,g=c;for(let _=1;_<u.length;_++){const b=u[_],N=_<=o.length?_-1:o.length,h=Math.abs(b.x-g.x)<Dn,k=Math.abs(b.y-g.y)<Dn;h&&k||(h?(p(b,N),y=!1):k?(p(b,N),y=!0):y?(p({x:g.x,y:b.y},N),p(b,N),y=!0):(p({x:b.x,y:g.y},N),p(b,N),y=!1),g=b)}return p(i,o.length),m}function La(e,t,o,i,a,r=20){const l=Ml(e,t,o,i,a,r);let s=`M ${dt(e.x)},${dt(e.y)}`;for(const c of l)s+=` L ${dt(c.b.x)},${dt(c.b.y)}`;return s}const If=14;function Pa(e,t,o,i,a,r=20){return Ml(e,t,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=If).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function dt(e){return Math.round(e*100)/100}const Cf=36;function Bl(e,t,o=Cf){const i=Math.max(e.x,t.x)+o;return`M ${dt(e.x)},${dt(e.y)} L ${dt(i)},${dt(e.y)} L ${dt(i)},${dt(t.y)} L ${dt(t.x)},${dt(t.y)}`}function za(e,t,o){const i=[e,...t,o];let a=`M ${dt(i[0].x)},${dt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${dt(i[r].x)},${dt(i[r].y)}`;return a}function Sf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ua(e,t){const o=Sf(e),i=e.width/2,a=e.height/2,r=t.x-o.x,l=t.y-o.y;if(Math.abs(r)<Dn&&Math.abs(l)<Dn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Fa(e,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 Ha(e,t,o){const i=[e,...t,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const $f={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Dl(e,t,o={}){const i={...$f,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),f=m?m.location:{x:0,y:0},p=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,_)=>{const b=_%y,N=Math.floor(_/y);r.push({id:g,location:{x:f.x+i.pad+b*i.cellWidth,y:f.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const f=m%i.ungroupedCols,p=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+f*i.cellWidth,y:d+p*i.cellHeight}})}),r}const Ol={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Ll(e,t={}){const o={...Ol,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Ga(e,t={}){const o={...Ol,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Ll(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}const si="inherited:";function Pl(e,t){return`${si}${e}:${t}`}function yo(e){return e.startsWith(si)}function ja(e){if(!yo(e))return null;const t=e.slice(si.length),o=t.indexOf(":");if(o<0)return null;const i=t.slice(0,o),a=t.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function go(e,t){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(t.some(r=>r.name===e.name))return[];const o=e.superClass||((a=t.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=t.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Pl(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}function ci(e,t,o,i,a="(논리명)"){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}function zl(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 Ul(e){var r,l,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||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const m=[...c.attributes].sort((p,y)=>p.order-y.order);for(const p of m){if(p.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${p.name?` ${p.name} ${"─".repeat(8)}`:""}`);continue}const y=p.dbAttrs[0],g=y!=null&&y.length?`(${y.length}${y.scale!=null?`,${y.scale}`:""})`:"",_=y?` → ${y.physicalName} ${y.dataType}${g}`:"",b=[p.identifier?"PK":"",p.notNull?"NOT NULL":"",y!=null&&y.unique?"UNIQUE":"",y!=null&&y.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${p.name}: ${p.type}${_}${b.length?` {${b.join(", ")}}`:""}`)}for(const p of c.indexes??[]){const y=p.columns.map(g=>{var _;return`${o.get(g.columnRef)??((_=ja(g.columnRef))==null?void 0:_.field)??g.columnRef}${g.descending?" DESC":""}`}).join(", ");a.push(` index ${p.name}${p.unique?" UNIQUE":""}: ${y}`)}const f=[...c.operations??[]].sort((p,y)=>p.order-y.order);for(const p of f){const y=p.visibility?` {${p.visibility}}`:"",g=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${y}${g}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${zl(c.end1.multiplicity)} —— ${zl(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
2
+ `).trim()}function Rf(e){return e==="CLASS"?"class":"er"}function Ka(e,t){return t==="class"?Bf(e):Tf(e)}function bo(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function Ya(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Fl(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=bo(t(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Af(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function Hl(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 Gl(e,t){return(t==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function Tf(e){var i,a;const t=Fl(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),o=["erDiagram"];for(const r of e.entities){const l=t.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${l}`);continue}o.push(` ${l} {`);for(const c of s){const d=c.dbAttrs[0],u=bo((d==null?void 0:d.dataType)||c.type,"unknown"),m=bo((d==null?void 0:d.physicalName)||c.name,"col"),f=[c.identifier?"PK":"",Af(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),p=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",y=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,g=Ya([y,p].filter(Boolean).join(" ")),_=[` ${u} ${m}`];f&&_.push(f);let b=_.join(" ");g&&(b+=` "${g}"`),o.push(b)}o.push(" }")}for(const r of e.associations){const l=t.get(r.end1.entityRef),s=t.get(r.end2.entityRef);if(!l||!s)continue;const c=`${Gl(r.end1.multiplicity,"left")}--${Gl(r.end2.multiplicity,"right")}`,d=Ya(r.description);o.push(` ${l} ${c} ${s} : "${d}"`)}return o.join(`
3
+ `)}function Vf(e){return e&&e!=="UNDEFINED"?e:null}function Mf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Bf(e){const t=Fl(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),r=[],l=Vf(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${Mf(c.type)} ${bo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${bo(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=t.get(i.end1.entityRef),r=t.get(i.end2.entityRef);if(!a||!r)continue;const l=Df(i),s=Ya(i.description),c=` ${a} "${Hl(i.end1.multiplicity)}" ${l} "${Hl(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
+ `)}function Df(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function De(){return crypto.randomUUID()}const Of={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},Lf={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function Pf(e,t){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(p=>p.trim()).filter(Boolean));let d,u,m;if(i!=null){const p=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(p){d=Number(p[1]),p[2]!=null&&(u=Number(p[2]));const y=i.slice(0,p.index).trim();y&&(m=y)}else i.trim()&&(m=i.trim())}const f={modelId:De(),physicalName:s,dataType:l};return d!=null&&(f.length=d),u!=null&&(f.scale=u),c.has("UK")&&(f.unique=!0),m&&(f.logicalName={ko:m}),{modelId:De(),name:s,type:l,attrType:c.has("FK")?"RELATION_OWN":"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:t,dbAttrs:[f]}}function jl(e){const t=e.split(`
5
+ `),o=[],i=new Map,a=[],r=c=>{const d=i.get(c);if(d)return d;const u={modelId:De(),name:c,stereotype:"JPA_ENTITY",table:{physicalName:c},attributes:[]};return o.push(u),i.set(c,u),u};let l=null;for(const c of t){const d=c.trim();if(!d||d==="erDiagram"||d.startsWith("%%"))continue;if(l){if(d==="}"){l=null;continue}const f=Pf(d,l.attributes.length);f&&l.attributes.push(f);continue}const u=d.match(/^(\S+)\s*\{$/);if(u){l=r(u[1]);continue}const m=d.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(m&&/--|\.\./.test(m[2])){const[f,p]=m[2].split(/--|\.\./);let y=(m[4]??"").trim();const g=y.match(/^"([^"]*)"$/);g&&(y=g[1]),a.push({left:m[1],right:m[3],cardL:f??"",cardR:p??"",label:y});continue}/^\S+$/.test(d)&&r(d)}const s=a.map(c=>{const d=r(c.left),u=r(c.right);return{modelId:De(),description:c.label||void 0,end1:{entityRef:d.modelId,multiplicity:Of[c.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:Lf[c.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return{modelId:De(),entities:o,associations:s,groups:[]}}function Kl(e){const t=jl(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yl={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},zf=Object.keys(Yl).sort((e,t)=>t.length-e.length),Wl=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,On=`${Wl}(?:\\.${Wl})*`,Uf=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s*\(([\s\S]*)\)\s*$`,"i"),Ff=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Hf=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${On})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Gf=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s+ON\s+(${On})\s*\(([^)]*)\)`,"i");function bt(e){let t=e.trim().replace(/[";`\[\]]/g,"");const o=t.lastIndexOf(".");return o>=0&&(t=t.slice(o+1)),t}function dn(e){const t=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(t.push(i),i=""):i+=a;return i.trim()&&t.push(i),t.map(a=>a.trim()).filter(Boolean)}function jf(e){const t=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!t)return null;const o=bt(t[1]),i=t[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const _ of zf)if(a.startsWith(_)){const b=Yl[_];r=b.dataType,l=!!b.autoIncrement;let N=i.slice(_.length);const h=N.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),N=N.slice(h[0].length)),d=N,u=!0;break}if(!u){const _=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);_&&(r=_[1].toUpperCase(),_[2]!=null&&(s=Number(_[2])),_[3]!=null&&(c=Number(_[3])),d=_[4]??"")}const m=d.toUpperCase(),f=/\bPRIMARY\s+KEY\b/.test(m),p=f||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),g={modelId:De(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),y&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:f,attr:{modelId:De(),name:o,type:r,attrType:"NORMAL",identifier:f,notNull:p,order:0,dbAttrs:[g]}}}function Kf(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ql(e){const t=e.match(/\(([^)]*)\)/);return t?dn(t[1]).map(bt):[]}function Wa(e){const t=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(d=>d.trim()).filter(Boolean);for(const d of c){const u=d.match(Uf);if(!u)continue;const m=bt(u[1]),f=u[2],p={modelId:De(),name:m,stereotype:"JPA_ENTITY",table:{physicalName:m},attributes:[]},y=new Map,g=[];let _=0;for(const b of dn(f)){if(Kf(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))g.push(...ql(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const k of ql(b)){const P=y.get(k.toLowerCase());P!=null&&P.dbAttrs[0]&&(P.dbAttrs[0].unique=!0)}const h=b.match(Ff);h&&l.push({childTable:m,childCols:dn(h[1]).map(bt),parentTable:bt(h[2]),parentCols:dn(h[3]).map(bt)});continue}const N=jf(b);if(!N){t.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}N.attr.order=_++,p.attributes.push(N.attr),y.set(N.attr.name.toLowerCase(),N.attr)}for(const b of g){const N=y.get(b.toLowerCase());N&&(N.identifier=!0,N.notNull=!0)}o.push(p),i.set(m.toLowerCase(),p);for(const[b,N]of y)a.set(`${m.toLowerCase()}.${b}`,N)}for(const d of c){const u=d.match(Hf);u&&l.push({childTable:bt(u[1]),childCols:dn(u[2]).map(bt),parentTable:bt(u[3]),parentCols:dn(u[4]).map(bt)})}for(const d of l){const u=i.get(d.childTable.toLowerCase()),m=i.get(d.parentTable.toLowerCase());if(!u||!m){t.push(`FK 대상 테이블 없음: ${d.childTable}→${d.parentTable}`);continue}const f={modelId:De(),end1:{entityRef:m.modelId,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};d.childCols.forEach((p,y)=>{const g=a.get(`${d.childTable.toLowerCase()}.${p.toLowerCase()}`),_=a.get(`${d.parentTable.toLowerCase()}.${(d.parentCols[y]??"").toLowerCase()}`);g&&(g.attrType="RELATION_OWN",g.derivedFrom={associationRef:f.modelId,sourceAttributeRef:(_==null?void 0:_.modelId)??""},y===0&&(f.end2.attributeRef=g.modelId))}),r.push(f)}for(const d of c){const u=d.match(Gf);if(!u)continue;const m=bt(u[3]),f=i.get(m.toLowerCase());if(!f){t.push(`인덱스 대상 테이블 없음: ${m}`);continue}const y=dn(u[4]).map(_=>bt(_.replace(/\s+(ASC|DESC)$/i,""))).map(_=>{var b,N;return(N=(b=a.get(`${m.toLowerCase()}.${_.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:N.modelId}).filter(_=>!!_).map(_=>({columnRef:_,descending:!1}));if(!y.length)continue;const g={modelId:De(),name:bt(u[2]),unique:!!u[1],columns:y};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:De(),entities:o,associations:r,groups:[]},warnings:t}}function Xl(e){const{logical:t}=Wa(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yf=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],Wf=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),qf=Yf.filter(e=>!Wf.has(e)),Xf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function qa(e){return Xf[e]??e}const Jf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),_o=new Set(["NUMERIC","DECIMAL"]);function Jl(e,t=qf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Rt="CustomType",Ln="GroupCodeEnum",Xa="String",di=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Ln,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Rt,label:"CustomType"}],Zf=new Map(di.map(e=>[e.value,e.label]));function Pn(e){return Zf.get(e)??e}const Qf=new Set([Ln,"CustomMoneyType"]),Zl=di.filter(e=>!Qf.has(e.value)).map(e=>e.value===Rt?{...e,label:"CustomType (사용자정의)"}:e);function Ql(e,t=[]){const o=t.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...Zl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Pn(e)},...i]:i}function ep(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ja(e,t){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((r=i.jpa)==null?void 0:r.collectionType)??"LIST"}function Za(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${Pn(t.type)}>`:ep(t)?Pn(t.type):e==="CLASS"?t.type===Rt&&t.customType||Pn(t.type):qa(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function ui(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function un(e,t){return ui(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function mn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function zn(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const ko=63;function mi(e){if(!e)return null;const t=e.length;return t>ko?t:null}function es(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Nt(e){return!e||e.trim()===""}function Eo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function tp(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const m=t.get(u.end1.entityRef)??[];m.push(u.end2.entityRef),t.set(u.end1.entityRef,m)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=u=>{r.set(u,i),l.push(u);for(const m of t.get(u)??[]){const f=r.get(m)??o;if(f===o)d(m);else if(f===i){const p=l.slice(l.indexOf(m)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}l.pop(),r.set(u,a)};for(const u of e.entities)(r.get(u.modelId)??o)===o&&d(u.modelId);return s}function fi(e,t,o,i,a){var r,l,s,c,d;if(!Nt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(u=>u.type===e.type))==null?void 0:l.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const m=(d=i.entities.find(f=>f.modelId===u))==null?void 0:d.attributes.flatMap(f=>f.dbAttrs)[o];return(m==null?void 0:m.physicalName)??""}return t.physicalName??""}function Qa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function ts(e,t){var r,l,s,c,d;const o=[];for(const u of Qa(e.entities,m=>m.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:u.name}});for(const u of e.entities){const m=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(Nt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(m.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId}),Nt((r=u.table)==null?void 0:r.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId})),u.stereotype==="JPA_EMBEDDABLE")for(const h of m.filter(k=>k.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.identifier&&k.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)if(!h.identifier)for(const k of h.dbAttrs)!k.autoIncrement&&Nt(k.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:k.autoIncrement?{name:h.name}:{name:h.name,seq:k.sequenceName??""}});for(const h of m.filter(k=>k.naturalId&&k.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&k.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&!k.notNull&&!k.identifier&&!k.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});!u.abstractClass&&m.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId}),(t==null?void 0:t.largeEntityThreshold)!=null&&m.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,params:{count:m.length,threshold:t.largeEntityThreshold}});for(const h of Qa(m,k=>k.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)Nt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId});const f=m.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=m.flatMap(h=>h.dbAttrs.map((k,P)=>({col:k,name:fi(h,k,P,e,t)})).filter(k=>k.col.sharedColumnRef==null));for(const h of Qa(p,k=>k.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of f){const k=mi(h.physicalName);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.physicalName}}),t!=null&&t.selectableDataTypes&&!Nt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}}),!Nt(h.dataType)&&Jf.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}})}if((l=t==null?void 0:t.embeddableCatalog)!=null&&l.length){const h=mn(un(u,e.entities));for(const k of m){if(k.attrType!=="EMBED_PREDEF")continue;const P=t.embeddableCatalog.find(A=>A.type===k.type);P&&k.dbAttrs.forEach((A,G)=>{if(A.sharedColumnRef==null)return;const K=P.fields[G],v=h.get(A.sharedColumnRef);if(!K||!v)return;(v.dataType!==K.dataType||(v.length??null)!==(K.length??null)||(v.scale??null)!==(K.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:u.modelId,params:{targetType:es(v),metaName:K.name,metaType:es(K)}})})}}for(const h of m){const k=h.dbAttrs[0];if(!(k!=null&&k.multiValue))continue;h.type===Ln&&k.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:{type:h.type||"",dataType:k.dataType||""}})}const y=(s=u.table)==null?void 0:s.physicalName,g=mi(y);g!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{max:ko,len:g}}),t!=null&&t.reservedWords&&!Nt(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:y}});const _=new Set;for(const h of u.attributes){_.add(h.modelId);for(const k of h.dbAttrs)_.add(k.modelId)}const b=new Set(go(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),N=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const k=mi(h.name);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const P of h.columns){const A=P.columnRef;if(_.has(A)||b.has(A))continue;const G=yo(A);G&&!N||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:G?{name:h.name,field:((d=ja(A))==null?void 0:d.field)??A}:{name:h.name}})}}}const i=new Map;for(const u of e.entities)for(const m of u.attributes)m.attrType==="EMBED_OWN"&&m.embedded&&i.set(m.embedded.associationRef,m);for(const u of e.associations){Eo(u.end1.multiplicity)&&Eo(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId});for(const m of["end1","end2"]){const f=u[m].jpa;if(!f)continue;const p=f.cascadeTypes??[],y=p.includes("ALL"),g=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&(g||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,params:{which:m,cascade:y?"ALL":"REMOVE"}}),Eo(u[m].multiplicity)&&f.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&Eo(u[m==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,params:{which:m}}),!Eo(u[m].multiplicity)&&(f.collectionType||f.collectionTable||f.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.collectionType==="SET"&&f.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of tp(e)){const m=[...u,u[0]].map(f=>a.get(f)??f).join(" → ");for(const f of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:f,params:{path:m}})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const f of e.associations)u.add(f.end1.entityRef),u.add(f.end2.entityRef);const m=new Map(e.entities.map(f=>[f.name,f.modelId]));for(const f of e.entities){for(const p of f.attributes)p.embedded&&(u.add(f.modelId),u.add(p.embedded.embeddableRef));if(!Nt(f.superClass)){u.add(f.modelId);const p=m.get(f.superClass);p&&u.add(p)}}for(const f of e.entities)u.has(f.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:f.modelId})}return o}function np(){return"postgres"}function ns(e,t="postgres",o){return lp(e,o)}const No=e=>e==null||e.trim()==="";function er(e){return[...e.attributes].filter(t=>t.attrType!=="DIVIDER"&&!t.transient).sort((t,o)=>t.order-o.order)}function op(e){return e.entities.filter(t=>t.stereotype!=="JPA_EMBEDDABLE")}function os(e){var t;return((t=e.table)==null?void 0:t.physicalName)||e.name}const ip={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function ap(e){const t=e.dataType;if(e.autoIncrement){if(t==="BIGINT")return"bigserial";if(t==="SMALLINT")return"smallserial";if(t==="INTEGER")return"serial"}return t==="NUMERIC"||t==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:t==="CHAR"||t==="NCHAR"?e.length!=null?`char(${e.length})`:"char":t==="VARCHAR"||t==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":ip[t]??t.toLowerCase()}function rp(e,t,o){const i=[];for(const a of er(e))a.dbAttrs.forEach((r,l)=>{if(r.sharedColumnRef!=null)return;const s=fi(a,r,l,t,o);No(s)||i.push({attr:a,col:r,name:s})});return i}function lp(e,t){const o=op(e),i=new Map,a=new Map,r=new Map;for(const u of e.entities)for(const m of u.attributes)i.set(m.modelId,u),m.dbAttrs.forEach((f,p)=>{const y=fi(m,f,p,e,t);p===0&&a.set(m.modelId,y),r.set(f.modelId,y)});const l=[],s=[],c=[];for(const u of o){const m=os(u),f=rp(u,e,t);if(f.length===0)continue;const p=f.map(({attr:b,col:N,name:h})=>{const k=[` ${h} ${ap(N)}`];return b.notNull&&!b.identifier&&k.push("NOT NULL"),N.unique&&k.push("UNIQUE"),k.join(" ")}),y=er(u).filter(b=>b.identifier).map(b=>a.get(b.modelId)).filter(b=>!No(b));y.length&&p.push(` PRIMARY KEY (${y.join(", ")})`),l.push(`CREATE TABLE ${m} (
6
+ ${p.join(`,
7
+ `)}
8
+ );`);const g=new Map;for(const b of er(u)){const N=b.derivedFrom;if(!N)continue;const h=a.get(b.modelId),k=i.get(N.sourceAttributeRef),P=a.get(N.sourceAttributeRef);if(No(h)||!k||No(P))continue;const A=g.get(N.associationRef)??{childCols:[],parentTable:os(k),parentCols:[]};A.childCols.push(h),A.parentCols.push(P),g.set(N.associationRef,A)}let _=0;for(const b of g.values()){const N=`fk_${m}_${b.parentTable}${g.size>1?`_${++_}`:""}`;s.push(`ALTER TABLE ${m} ADD CONSTRAINT ${N} FOREIGN KEY (${b.childCols.join(", ")}) REFERENCES ${b.parentTable} (${b.parentCols.join(", ")});`)}for(const b of u.indexes??[]){const N=b.columns.map(k=>r.get(k.columnRef)).filter(k=>!No(k));if(!N.length)continue;const h=b.name||`ix_${m}_${N.join("_")}`;c.push(`CREATE ${b.unique?"UNIQUE ":""}INDEX ${h} ON ${m} (${N.join(", ")});`)}}return[l.join(`
9
+
10
+ `),s.join(`
11
+ `),c.join(`
12
+ `)].filter(u=>u.length).join(`
13
+
14
+ `)}const tr="entity-modeler-diagram",nr=1;class fn extends Error{constructor(t){super(t),this.name="InvalidDiagramJsonError"}}function is(e,t){return JSON.stringify({format:tr,version:nr,logical:e,layout:t},null,2)}const pi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Un=e=>Array.isArray(e)?e:[];function as(e){let t;try{t=JSON.parse(e)}catch{throw new fn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!pi(t))throw new fn("최상위가 객체가 아닙니다.");if(t.format!==tr)throw new fn(`형식이 아닙니다(format=${String(t.format)}).`);if(typeof t.version!="number"||t.version>nr)throw new fn(`지원하지 않는 버전(version=${String(t.version)}).`);const o=t.logical;if(!pi(o)||!Array.isArray(o.entities))throw new fn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!pi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new fn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Un(o.associations),groups:Un(o.groups)},a=pi(t.layout)?t.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Un(a.entityLayouts),associationLayouts:Un(a.associationLayouts),groupLayouts:Un(a.groupLayouts),notes:Un(a.notes)};return{logical:i,layout:r}}const sp=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function _t(e){return e.replace(sp,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Le(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rs(e){return`<text ${[`x="${Le(e.x)}"`,`y="${Le(e.y)}"`,`fill="${_t(e.fill)}"`,`font-size="${Le(e.fontSize)}"`,e.fontFamily?`font-family="${_t(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${_t(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${_t(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${_t(e.text)}</text>`}function cp(e){return`<line x1="${Le(e.x1)}" y1="${Le(e.y)}" x2="${Le(e.x2)}" y2="${Le(e.y)}" stroke="${_t(e.stroke)}" stroke-width="${Le(e.strokeWidth??1)}" />`}function dp(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 up(e,t,o,i,a){return[`M${Le(e+a.tl)},${Le(t)}`,`L${Le(e+o-a.tr)},${Le(t)}`,a.tr?`Q${Le(e+o)},${Le(t)} ${Le(e+o)},${Le(t+a.tr)}`:"",`L${Le(e+o)},${Le(t+i-a.br)}`,a.br?`Q${Le(e+o)},${Le(t+i)} ${Le(e+o-a.br)},${Le(t+i)}`:"",`L${Le(e+a.bl)},${Le(t+i)}`,a.bl?`Q${Le(e)},${Le(t+i)} ${Le(e)},${Le(t+i-a.bl)}`:"",`L${Le(e)},${Le(t+a.tl)}`,a.tl?`Q${Le(e)},${Le(t)} ${Le(e+a.tl)},${Le(t)}`:"","Z"].filter(Boolean).join(" ")}function or(e){const t=dp(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${_t(e.fill)}"`,`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Le(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${up(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Le(e.x)}" y="${Le(e.y)}" width="${Le(e.w)}" height="${Le(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(cp(l));for(const l of e.texts)r.push(rs(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function mp(e){const o=[`<path ${[`d="${_t(e.d)}"`,'fill="none"',`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(rs(i));return`<g>${o.join("")}</g>`}function ls(e){const{x:t,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Le(t)}" y="${Le(o)}" width="${Le(i)}" height="${Le(a)}" fill="${_t(e.background)}" />`);for(const l of e.groups)r.push(or(l));for(const l of e.edges)r.push(mp(l));for(const l of e.entities)r.push(or(l));for(const l of e.notes)r.push(or(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Le(t)} ${Le(o)} ${Le(i)} ${Le(a)}" width="${Le(i)}" height="${Le(a)}">`+r.join("")+"</svg>"}function ir(e,t){var r,l,s;const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=t.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}const Fn="javax.persistence",We={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},hi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function fp(e){if(!e)return;if(hi[e])return{simpleName:e,fqn:hi[e]};const t=Object.entries(hi).find(([,o])=>o===e);return t?{simpleName:t[0],fqn:t[1]}:void 0}function pp(e,t,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of t){const l=i.get(r);l&&a.push(bp(l,e,o))}return a}class ss{constructor(){qe(this,"imports",new Set);qe(this,"body",[]);qe(this,"fillIns",[])}import(t){t.includes(".")&&!t.startsWith("java.lang.")&&this.imports.add(t)}jpa(t){this.import(`${Fn}.${t}`)}line(t=""){this.body.push(t)}fillIn(t){this.fillIns.push(t)}render(t){const o=[`package ${t};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
15
+ `)+`
16
+ `}}function cs(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function hp(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(t,o)=>o.toUpperCase()):""}function Hn(e,t){t&&(e.import(We.lombokGetter),e.line(" @Getter"))}const yp=["ko","en","ja","zh"];function ar(e,t){if(!e)return[];const o=yp.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${t} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${t}/**`,`${t} * <ul>`,...o,`${t} * </ul>`,`${t} */`]}function yi(e,t,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...di,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Ln){if(i){const c=[`${Fn}.Enumerated`,`${Fn}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${Fn}.Enumerated`,`${Fn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===Rt){const c=fp(t),d=c?`CustomType '${t}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${t??"(미지정)"}`;return{...a,type:t||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${Fn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=hi[e];if(s)return{type:e,primitive:!1,imports:[s,We.jdbcTypeCode,We.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function ds(e){return e.attributes.filter(t=>t.identifier&&(t.attrType==="NORMAL"||t.attrType==="RELATION_OWN")).sort((t,o)=>t.order-o.order)}function rr(e,t,o,i=new Set){if(e.attrType!=="RELATION_OWN")return yi(e.type,e.customType,o,e.groupCode).type;const a=t.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return yi(e.type,e.customType,o).type;const r=ds(a);return r.length>=2?`${a.name}PK`:r.length===1?rr(r[0],t,o,new Set([...i,a.modelId])):yi(e.type,e.customType,o).type}function gp(e,t,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!t)return!1;const i=!sr(t.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function bp(e,t,o){var K,v,T,H,C,ae;if(e.stereotype==="JPA_EMBEDDABLE")return _p(e,t,o);const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi);const l=new Map(t.entities.map(E=>[E.modelId,E])),s=r,c=Cp(e,o,i),d=new Map;for(const E of t.associations)E.end2.attributeRef&&d.set(E.end2.attributeRef,{assoc:E,role:"owner"}),E.end1.attributeRef&&E.end1.navigable&&d.set(E.end1.attributeRef,{assoc:E,role:"inverse"});const u=ds(e),m=new Set(u.filter(E=>E.attrType==="NORMAL").flatMap(E=>E.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),f=new Set;for(const E of u)gp(E,(K=d.get(E.modelId))==null?void 0:K.assoc,m)&&f.add(E.modelId);const p=u.filter(E=>!f.has(E.modelId)),y=p.length>=2,g=p.length===1,_=`${a}PK`,b=E=>f.has(E.modelId)?"mapsId":E.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator);const h=["@Entity"];h.push(Np(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${r}.${a}.${_}`),h.push(`@IdClass(${a}.${_}.class)`)),(v=e.jpaAttrs)!=null&&v.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(We.dynamicInsert)),(T=e.jpaAttrs)!=null&&T.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(We.dynamicUpdate)),(H=e.jpaAttrs)!=null&&H.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),N&&(i.import(We.lombokNoArgs),i.import(We.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const E of ar((C=e.table)==null?void 0:C.logicalName,""))i.line(E);for(const E of h)i.line(E);i.line(`public class ${a}${c} {`);const k=e.attributes.filter(E=>E.attrType!=="DIVIDER").sort((E,Y)=>E.order-Y.order),P=(ae=e.jpaAttrs)!=null&&ae.useVersion?u.length?u[u.length-1].modelId:null:void 0,A=[];for(const E of k){if(E.attrType.startsWith("EMBED"))A.push(...hs(E,e,t,o,i));else if(E.attrType==="RELATION_OWN"){const Y=d.get(E.modelId);Y&&A.push(vp(E,Y.assoc,s,l,b(E),N,t,o,i))}else if(E.attrType==="RELATION_REF"){const Y=d.get(E.modelId);Y&&A.push(xp(E,Y.assoc,s,l,N,t,o,i))}else A.push(fs(E,a,o,i));E.modelId===P&&us(i,A,N)}P===null&&us(i,A,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),ms(A,i,N),y&&(i.import(We.jsonBackReference),i.import(We.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${_} getPK() {`),i.line(` return (${_}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Sp(_,p.map(E=>({type:rr(E,t,o),name:E.name})),N,i)),i.line("}");let G;return y?G=$p(a,_,r):g&&(G=Rp(a,r,rr(p[0],t,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:G}}function us(e,t,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||t.push({type:"int",name:"dataVersion",category:0})}function ms(e,t,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;t.line(""),t.line(` public ${a.type} get${cs(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(t.import("java.util.Collections"),t.line(` return Collections.${r}(this.${a.name});`)):t.line(` return ${a.name};`),t.line(" }")}}function _p(e,t,o){var c;const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi),i.jpa("Embeddable"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator),i.import(We.serializable);for(const d of ar((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const l=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of l){if(d.attrType.startsWith("EMBED")){s.push(...hs(d,e,t,o,i));continue}s.push(fs(d,a,o,i))}return ms(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function fs(e,t,o,i){const a=e.dbAttrs[0],r=e.name||hp(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${t}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=yi(e.type,e.customType,o,e.groupCode);for(const d of l.imports)i.import(d);for(const d of l.fillIns)i.fillIn(`${t}.${r}: ${d}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${t}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of ar(a==null?void 0:a.logicalName," "))i.line(d);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(We.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Ip(e,a,i)}`);for(const d of l.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Hn(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(Hn(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function ps(e,t,o){var r,l;if(e.attrType==="EMBED_PREDEF"){const s=(r=o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,m;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((m=s==null?void 0:s.fields[d])==null?void 0:m.physicalName)??""}})}const i=(l=e.embedded)!=null&&l.embeddableRef?t.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function kp(e,t,o,i,a){const r=mn(un(t,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=zn(s,r);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${t.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const m=s.physicalName||d.defaultPhysical;m&&m!==d.defaultPhysical&&l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${m}"))`)}),l}function hs(e,t,o,i,a){var m,f,p,y;const r=t.name,l=wo(t,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(_=>_.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const _=wo(g,o,i);_&&_!==l&&a.import(`${_}.${g.name}`)}}if(e.type==="Money")return[Ep(e,t,o,i,a)];const c=ps(e,o,i),d=kp(e,t,o,c,a),u=Ja(e,o.associations);if(a.line(""),u){const g=o.associations.find(P=>{var A;return P.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),_=g?g.end2.entityRef===((f=e.embedded)==null?void 0:f.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(p=_==null?void 0:_.jpa)==null?void 0:p.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),lr(d,a);const N=u==="SET";!N&&((y=_==null?void 0:_.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${_.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${s}>`:`List<${s}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${k};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),lr(d,a),Hn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Ep(e,t,o,i,a){a.jpa("Embedded"),a.import(We.compositeType),a.import(We.money),a.import(We.moneyUserType);const r=ps(e,o,i),l=mn(un(t,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var _,b;const u=((_=r[d])==null?void 0:_.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=zn(c,l),f=((b=r[d])==null?void 0:b.defaultPhysical)||"",p=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!p||p===f))return[];const g=[`name = "${m?m.physicalName:p||f}"`];return e.notNull&&g.push("nullable = false"),m?g.push("insertable = false","updatable = false"):(c.insertable===!1&&g.push("insertable = false"),c.updatable===!1&&g.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${g.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),lr(s,a),Hn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function lr(e,t){e.length!==0&&(t.jpa("AttributeOverride"),t.jpa("AttributeOverrides"),t.jpa("Column"),t.line(" @AttributeOverrides({"),e.forEach((o,i)=>t.line(` ${o}${i<e.length-1?",":""}`)),t.line(" })"))}function Np(e,t,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const r=new Map;for(const d of e.attributes)for(const u of d.dbAttrs)r.set(u.modelId,u.physicalName);for(const d of go(e,t.superClassCatalog??[]))r.set(d.modelId,d.physicalName);const l=a.map(d=>{const u=[];for(const f of d.columns){const p=r.get(f.columnRef);p?u.push(p):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${f.columnRef}) — 카탈로그 확인`)}const m=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${u.join(", ")}"${m})`});if(l.length===1)return`@Table(name = "${i}", indexes = { ${l[0]} })`;const s=l.map(d=>` ${d}`).join(`,
17
+ `);return`@Table(name = "${i}", indexes = {
18
+ ${s}
19
+ })`}function sr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function wp(e,t,o){var r;const i=o.get(t.end1.entityRef);if(e.derivedFrom){const l=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(l!=null&&l.dbAttrs[0])return l.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(l=>l.identifier&&l.dbAttrs.length>0);return(r=a==null?void 0:a.dbAttrs[0])==null?void 0:r.physicalName}function ys(e,t,o,i,a){if(!e)return;const r=wo(e,o,i);r&&r!==t&&a.import(`${r}.${e.name}`)}function vp(e,t,o,i,a,r,l,s,c){var N,h;const d=i.get(t.end1.entityRef),u=(d==null?void 0:d.name)??t.end1.entityRef,m=sr(t.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),ys(d,o,l,s,c);const f=t.end2.jpa,p=[];e.notNull&&p.push("optional = false"),f!=null&&f.fetchType&&(c.jpa("FetchType"),p.push(`fetch = FetchType.${f.fetchType}`)),(N=f==null?void 0:f.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),p.push(`cascade = { ${f.cascadeTypes.map(k=>`CascadeType.${k}`).join(", ")} }`));const y=e.dbAttrs[0];c.jpa("JoinColumn");const g=wp(e,t,i),_=(y==null?void 0:y.physicalName)||g||"",b=[];return _?b.push(`name = "${_}"`):c.fillIn(`${((h=i.get(t.end2.entityRef))==null?void 0:h.name)??""}.${e.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),g&&b.push(`referencedColumnName = "${g}"`),e.notNull&&b.push("nullable = false"),(y==null?void 0:y.insertable)===!1&&b.push("insertable = false"),(y==null?void 0:y.updatable)===!1&&b.push("updatable = false"),c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${p.length?`(${p.join(", ")})`:""}`),c.line(` @JoinColumn(${b.join(", ")})`),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Hn(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function xp(e,t,o,i,a,r,l,s){const c=i.get(t.end2.entityRef),d=(c==null?void 0:c.name)??t.end2.entityRef;ys(c,o,r,l,s);const u=c==null?void 0:c.attributes.find(P=>P.modelId===t.end2.attributeRef),m=(u==null?void 0:u.name)??"",f=sr(t.end2.multiplicity);if(s.line(""),!f)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),Hn(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const p=t.end1.jpa,y=t.end1.composition||t.end2.composition;let g=(p==null?void 0:p.cascadeTypes)??[],_=p==null?void 0:p.orphanRemoval;y&&g.length===0&&(g=["ALL"],_==null&&(_=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),b.push(`cascade = { ${g.map(P=>`CascadeType.${P}`).join(", ")} }`)),_&&b.push("orphanRemoval = true"),p!=null&&p.fetchType&&(s.jpa("FetchType"),b.push(`fetch = FetchType.${p.fetchType}`)),s.line(` @OneToMany(${b.join(", ")})`),p!=null&&p.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${p.orderBy}")`));const N=(p==null?void 0:p.collectionType)==="SET";s.import(N?"java.util.Set":"java.util.List"),s.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${d}>`:`List<${d}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${k};`),{type:h,name:e.name,category:1,collection:!0}}function Ip(e,t,o){o.jpa("Column");const i=[`name = "${(t==null?void 0:t.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),t){const a=_o.has(t.dataType);t.length!=null&&i.push(a?`precision = ${t.length}`:`length = ${t.length}`),t.scale!=null&&i.push(`scale = ${t.scale}`),t.insertable===!1&&i.push("insertable = false"),t.updatable===!1&&i.push("updatable = false"),t.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function Cp(e,t,o){var l;const i=t.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function Sp(e,t,o,i){i.import(We.serializable),i.import(We.objects),i.import(We.jsonUtils),o&&i.import(We.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of t)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${t.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of t)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of t)i.line(""),i.line(` public ${a.type} get${cs(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${t.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${t.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function $p(e,t,o){const i=[`${o}.${e}`,`${o}.${e}.${t}`,We.jpaRepository,We.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${t}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
20
+ `)+`
21
+ `}}function Rp(e,t,o){const i=[`${t}.${e}`,We.jpaRepository,We.querydslExecutor].sort(),a=[`package ${t};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
22
+ `)+`
23
+ `}}const gi="com.example",Ap="command.domain";function wo(e,t,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=t.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),r=a!=null&&a.packageName?`.${a.packageName}`:"",l=i.layerSuffix??Ap,s=l?`.${l}`:"";return`${i.basePackage}${r}${s}`}return t.packageName||""}const Tp="CustomMoneyType",Vp="Money";function Mp(e){return!(e.type!==Tp||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Bp(e){const t=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Vp,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Dp(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Mp(l)?(a=!0,t=!0,Bp(l)):l);return a?{...i,attributes:r}:i});return t?{...e,entities:o}:e}function gs(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function bs(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(gs);if(!i.length)continue;const a=o.filter(s=>!gs(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),t.attributes=l}}function Gn(e){return JSON.parse(JSON.stringify(e))}function _s(e,t,o){var K;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(t);if(o.includeRelated){const v=new Set(t);for(const T of r.associations){const H=v.has(T.end1.entityRef),C=v.has(T.end2.entityRef);H!==C&&s.add(H?T.end2.entityRef:T.end1.entityRef)}}const c=r.entities.filter(v=>s.has(v.modelId)),d=new Set(c.map(v=>v.modelId)),u=r.associations.filter(v=>d.has(v.end1.entityRef)&&d.has(v.end2.entityRef)),m=new Set(u.map(v=>v.modelId)),f=new Map,p=v=>{let T=f.get(v);return T||(T=i(),f.set(v,T)),T};for(const v of c){p(v.modelId);for(const T of v.attributes){p(T.modelId);for(const H of T.dbAttrs)p(H.modelId)}for(const T of v.indexes??[])p(T.modelId);for(const T of v.operations??[])p(T.modelId)}for(const v of u)p(v.modelId);const y=v=>f.get(v),g=c.map(v=>{const T=Gn(v);T.modelId=y(v.modelId),T.attributes=T.attributes.map(H=>Op(H,y,m,d));for(const H of T.indexes??[])H.modelId=y(H.modelId),H.columns=H.columns.map(C=>yo(C.columnRef)?C:{...C,columnRef:y(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const H of T.operations??[])H.modelId=y(H.modelId);return T});bs(g);const _=u.map(v=>{const T=Gn(v);return T.modelId=y(v.modelId),T.end1=ks(T.end1,y),T.end2=ks(T.end2,y),T}),b=[];for(const v of r.groups){const T=v.memberEntityRefs.filter(C=>d.has(C));if(T.length===0)continue;const H=Gn(v);H.modelId=p(v.modelId),H.memberEntityRefs=T.map(C=>y(C)),b.push(H)}const N=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map(v=>v.name)),k=new Set(o.existing.entities.map(v=>{var T;return(T=v.table)==null?void 0:T.physicalName}).filter(v=>!!v));for(const v of g)h.has(v.name)&&(v.name=`${v.name}${N}`),(K=v.table)!=null&&K.physicalName&&k.has(v.table.physicalName)&&(v.table.physicalName=`${v.table.physicalName}${N}`);const P=[];for(const v of l.entityLayouts){const T=y(v.entityRef);if(!T)continue;const H=Gn(v);H.entityRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},H.attributeStyles&&(H.attributeStyles=bi(H.attributeStyles,y)),H.operationStyles&&(H.operationStyles=bi(H.operationStyles,y)),P.push(H)}const A=[];for(const v of l.associationLayouts){const T=y(v.associationRef);if(!T)continue;const H=Gn(v);H.associationRef=T,H.sourceColumnRef=v.sourceColumnRef?y(v.sourceColumnRef):void 0,H.targetColumnRef=v.targetColumnRef?y(v.targetColumnRef):void 0,H.waypoints=H.waypoints.map(C=>cr(C,a)),A.push(H)}const G=[];for(const v of l.groupLayouts){const T=y(v.groupRef);if(!T)continue;const H=Gn(v);H.groupRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},delete H.memberNoteRefs,G.push(H)}return{logical:{entities:g,associations:_,groups:b},layout:{entityLayouts:P,associationLayouts:A,groupLayouts:G},idMap:f}}function cr(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Op(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const r=t(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function ks(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function bi(e,t){const o={};for(const[i,a]of Object.entries(e)){const r=t(i);r&&(o[r]=a)}return o}function dr(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function jn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>jn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!jn(e[i],t[i]))return!1;return!0}return!1}function pn(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const r of a)o.has(r)||jn(e[r],t[r])||(i[r]=t[r]===void 0?null:t[r]);return Object.keys(i).length?i:null}function hn(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function Lp(e,t){const o=new Set(e),i=new Set(t),a=t.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const Pp=new Set(["attributes","operations","indexes","rev"]),zp=new Set(["end1","end2","rev"]),Up=new Set(["memberEntityRefs","rev"]),Es=new Set(["modelId"]),Fp=new Set(["modelId","columns"]),Hp=new Set([]);function Gp(e,t,o,i){const a=hn(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=pn(s,c,Es);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=hn(t.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=pn(s,c,Es);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=hn(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!jn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=pn(s,c,Fp);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function jp(e,t,o){const i=hn(e.entities??[],t.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of i.common){const c=pn(l,s,Pp);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Gp(l.modelId,l,s,o)}const a=hn(e.associations??[],t.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of a.common){const c=pn(l,s,zp);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=pn(l[d]??{},s[d]??{},Hp);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=hn(e.groups??[],t.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of r.common){const c=pn(l,s,Up);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Lp(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function _i(e,t,o,i,a,r,l){const s=hn(e,t,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)jn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function Kp(e,t,o){_i(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),_i(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),_i(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),_i(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Yp(e,t){const o=[];return jp(e.logical,t.logical,o),Kp(e.layout,t.layout,o),o}function Wp(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const qp={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Xp{constructor(t){qe(this,"out",[]);qe(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...vo(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...vo(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...vo(t),field:a,value:void 0,removed:!0});continue}this.out.push({...vo(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...vo(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function vo(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function At(e,t,o,i){if(o==null||typeof o!="object")return;const a=qp[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(t,r,l)}function yn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ur(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Zt(e,t){var r,l,s,c,d,u,m,f;const o=Wp(t),i=new Xp(t.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?At(i,p,y.value,"entity"):y.kind==="entity.update"?yn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((r=y.value)==null?void 0:r.attributes,t.attributeRef);g&&At(i,p,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===t.attributeRef?At(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?yn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((s=y.value)==null?void 0:s.operations,t.operationRef);g&&At(i,p,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?At(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?yn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((d=y.value)==null?void 0:d.indexes,t.indexRef);g&&At(i,p,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?At(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?yn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?At(i,p,y.value,"association"):y.kind==="association.update"?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const g=(m=y.value)==null?void 0:m[t.end];At(i,p,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){At(i,p,y.value,"group");const g=(f=y.value)==null?void 0:f.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(p,_,!1)}else y.kind==="group.update"?yn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function Jp(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Kn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Zp(e,t){const o=new Set,i=new Set,a=new Set;for(const r of e)for(const l of r.ops){const s=l;if(l.kind==="entity.add"&&s.entityRef===t){const c=s.value;Kn(c==null?void 0:c.attributes,o),Kn(c==null?void 0:c.operations,i),Kn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(l.kind==="attribute.add"?Kn([s.value],o):l.kind==="attribute.update"||l.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):l.kind==="operation.add"?Kn([s.value],i):l.kind==="operation.update"||l.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):l.kind==="index.add"?Kn([s.value],a):(l.kind==="index.update"||l.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function ki(e,t){return e.map(o=>({...o,subject:t}))}function Ns(e,t){const o=e.filter(s=>s.ops.some(c=>Jp(c,t))),{attributes:i,operations:a,indexes:r}=Zp(o,t),l=[...ki(Zt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)l.push(...ki(Zt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ki(Zt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ki(Zt(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function ws(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qp(e){var i,a,r;const t=new Set,o=(l,s)=>{typeof s=="string"&&t.add(`${l}:${s}:`)};for(const l of e)for(const s of l.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(r=c.value)==null?void 0:r.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function eh(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const r of a.ops){const l=r,s=r.kind;if(s.startsWith("entity."))typeof l.entityRef=="string"&&t.add(l.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=l.containerRef??l.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof l.associationRef=="string"&&o.add(l.associationRef):s.startsWith("group.")&&typeof l.groupRef=="string"&&i.add(l.groupRef)}return{entities:t,associations:o,groups:i}}function th(e){const{entities:t,associations:o,groups:i}=eh(e),a=[];for(const r of t)for(const l of Ns(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Zt(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Zt(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Zt(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function vs(e){const t=th(e),o=Qp(e),i=new Map;for(const l of t){const s=ws(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of t){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=ws(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}class mr{constructor(t){qe(this,"undoStack",[]);qe(this,"redoStack",[]);qe(this,"savePoint",null);qe(this,"listeners",new Set);qe(this,"commandListeners",new Set);qe(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function xs(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function ot(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function wt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Xe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function zt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function Ei(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=xs(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=ot(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Is(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=xs(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=ot(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(f=>f.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const r of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function Cs(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Xe(i,e);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(i){Object.assign(Xe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Ss(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Xe(i,e);o=a.name,a.name=t},invert(i){Xe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Yn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...t}},invert(i){const a=ot(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function $s(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...t}},invert(i){const a=ot(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function xo(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Rs(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=xo(r.style,t)},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=ot(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function As(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=t},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Ts(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=t},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function fr(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:t[l]}})}),{forward:i,invert:a}}}}function Ni(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=ot(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function wi(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Vs(e,t){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ms(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Bs(e,t){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(t)&&(r.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(t))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function vi(e,t){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(t))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ds(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Os(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Ls(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=xo(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Ps(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Ut(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Xe(o,e).attributes.push(t)},invert(o){const i=Xe(o,e),a=i.attributes.findIndex(r=>r.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function gn(e,t,o){const i={},a=r=>{const l=Xe(r,e).attributes.find(s=>s.modelId===t);if(!l)throw new Error(`속성 없음: ${t}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function Wn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Xe(i,e),r=a.attributes.findIndex(l=>l.modelId===t);if(r<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Xe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function pr(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Xe(a,e);i=r.attributes.map(m=>({...m}));const l=new Set(t),s=r.attributes.filter(m=>l.has(m.modelId)),c=r.attributes.filter(m=>!l.has(m.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];r.attributes.splice(0,r.attributes.length,...u),r.attributes.forEach((m,f)=>m.order=f)},invert(a){i&&Xe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Xe(a,e).attributes.map(l=>({...l}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function zs(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Xe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var l;const a=Xe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===t.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Us(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`메서드 없음: ${t}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Fs(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Xe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(r<0)throw new Error(`메서드 없음: ${t}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Xe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Hs(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Xe(a,e),l=r.operations??[];i=l.map(f=>({...f}));const s=new Set(t),c=l.filter(f=>s.has(f.modelId)),d=l.filter(f=>!s.has(f.modelId)),u=Math.max(0,Math.min(o,d.length)),m=[...d.slice(0,u),...c,...d.slice(u)];l.splice(0,l.length,...m),l.forEach((f,p)=>f.order=p),r.operations=l},invert(a){if(!i)return;const r=Xe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=(Xe(a,e).operations??[]).map(l=>({...l}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Gs(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=ot(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function xi(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function js(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Ii(e,t){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function Qt(e,t,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[t]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function Ks(e,t){return{label:"인덱스 추가",apply(o){const i=Xe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var r;const i=Xe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Ys(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`인덱스 없음: ${t}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function Ws(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Xe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===t))??-1;if(r<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Xe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Tt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Io=(e,t)=>{var o;return((o=wt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function qs(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=wt(a,e);if(!r||!r.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...r.waypoints[t]},r.waypoints.splice(t,1,{...o})},invert(a){const r=wt(a,e);r&&i&&r.waypoints.splice(t,1,i)},emitOps(a){const r=Io(a,e),l=r.map((s,c)=>c===t&&i?{...i}:s);return{forward:[Tt(e,r)],invert:[Tt(e,l)]}}}}function Xs(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=wt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=wt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Io(i,e),r=a.slice();return o&&r.splice(t,0,{...o}),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function Js(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=wt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+t,y:l.y+o}))},invert(a){const r=wt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Tt(e,Io(a,e))],invert:[Tt(e,i??[])]}}}}function Zs(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=wt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=wt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[Tt(e,Io(o,e))],invert:[Tt(e,t??[])]}}}}function Qs(e,t,o){return{label:"waypoint 추가",apply(i){const a=wt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=wt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Io(i,e),r=a.slice();return r.splice(t,1),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function ec(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function tc(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Co(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function nc(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function oc(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function ic(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=xo(a.style,t)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function ac(e,t){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(t)&&(l.memberNoteRefs.push(t),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(t);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function rc(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(t))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const en=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Ci=(e,t,o)=>{var i;return((i=zt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function lc(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===t)){o=!1;return}r.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===t);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function sc(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function cc(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(r){const l=zt(r,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=zt(r,e,t);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ci(r,e,t),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[en(e,t,l)],invert:[en(e,t,s)]}}}}function dc(e,t,o,i){return{label:"waypoint 추가",apply(a){const r=zt(a,e,t);if(!r)throw new Error(`노트 연결 없음: ${e}→${t}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=zt(a,e,t);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return l.splice(o,1),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function uc(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const r=zt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=zt(a,e,t);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function mc(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=zt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=zt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[en(e,t,Ci(i,e,t))],invert:[en(e,t,o??[])]}}}}function Je(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const nh=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:xi,addAttribute:Ut,addEntity:Ei,addEntityToGroup:Bs,addGroup:wi,addIndex:Ks,addNote:ec,addNoteConnection:lc,addNoteConnectionWaypoint:dc,addNoteToGroup:ac,addOperation:zs,addWaypoint:Qs,clearNoteConnectionWaypoints:mc,clearWaypoints:Zs,composite:Je,moveEntity:Yn,moveGroup:Ds,moveNote:Co,moveNoteConnectionWaypoint:cc,moveWaypoint:qs,removeAssociation:js,removeAttribute:Wn,removeEntity:Is,removeEntityFromGroup:vi,removeGroup:Ms,removeIndex:Ws,removeNote:tc,removeNoteConnection:sc,removeNoteConnectionWaypoint:uc,removeNoteFromGroup:rc,removeOperation:Fs,removeWaypoint:Xs,renameEntity:Ss,reorderAttributes:pr,reorderOperations:Hs,resizeEntity:$s,resizeGroup:Os,resizeNote:nc,setAllEntitiesCollapsed:fr,setAttributeSwatch:Ni,setEntityCollapsed:As,setEntityLocked:Ts,setEntitySwatch:Rs,setGroupLocked:Ps,setGroupSwatch:Ls,setNoteMemo:oc,setNoteSwatch:ic,setOperationSwatch:Gs,translateWaypoints:Js,updateAssociation:Ii,updateAssociationEnd:Qt,updateAttribute:gn,updateEntity:Cs,updateGroup:Vs,updateIndex:Ys,updateOperation:Us},Symbol.toStringTag,{value:"Module"}));class fc{constructor(){qe(this,"revs",new Map);qe(this,"layoutVersion",0);qe(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class pc{constructor(t){qe(this,"cache",new fc);qe(this,"newClientOpId");qe(this,"debounceMs");qe(this,"emissions",new WeakMap);qe(this,"open",null);qe(this,"debounceHandle",null);qe(this,"queue",[]);qe(this,"sending",!1);qe(this,"_frozen",!1);qe(this,"stack",null);qe(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??De,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var l;if(this._frozen)return;let a;if(o==="do"){const s=(l=t.emitOps)==null?void 0:l.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=r,this.emissions.set(t,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let a=!1,r=!1;for(const l of t)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(r){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",r),(a=(i=this.opts).onError)==null||a.call(i,r),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const hc=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"],yc=()=>crypto.randomUUID(),oh=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,ih=e=>e&&e[0].toLowerCase()+e.slice(1),ah=e=>e&&e[0].toUpperCase()+e.slice(1),rh=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function lh(e,t){return ih(e)+ah(t)}function sh(e,t){const o=e.entities.find(l=>l.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(l=>l.identifier&&(l.attrType==="NORMAL"||l.attrType==="RELATION_OWN")).sort((l,s)=>l.order-s.order).map(l=>{const s=lh(o.name,l.name);return{associationRef:t.modelId,sourceAttributeRef:l.modelId,name:s,type:l.type,identifier:a,notNull:a,dbAttrs:l.dbAttrs.map(c=>({physicalName:rh(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,t)=>`${e}::${t}`,$i=e=>e??void 0;function ch(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||$i(s.length)!==$i(r.length)||$i(s.scale)!==$i(r.scale)}))&&(i.dbAttrs=t.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function dh(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function So(e,t,o=yc){const i={add:[],update:[],remove:[]},a=e.entities.find(m=>m.modelId===t);if(!a)return i;const r=e.associations.filter(m=>m.end2.entityRef===t),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(m=>sh(e,m)),s=new Map(l.map(m=>[Si(m.associationRef,m.sourceAttributeRef),m])),c=a.attributes.filter(m=>m.derivedFrom),d=new Map(c.map(m=>[Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef),m]));for(const m of c){const f=Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef);s.has(f)||i.remove.push(m.modelId)}let u=a.attributes.reduce((m,f)=>Math.max(m,f.order),-1)+1;for(const m of l){const f=Si(m.associationRef,m.sourceAttributeRef),p=d.get(f);if(!p)i.add.push(dh(m,u++,o));else{const y=ch(p,m,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function uh(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function mh(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function fh(e,t,o=yc){const i=new Map,a=mh(e),r=new Set,l=[t];for(;l.length;){const s=l.shift();if(r.has(s))continue;r.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=So(a,d,o);if(oh(u))continue;i.has(d)||i.set(d,u);const m=a.entities.find(f=>f.modelId===d);m&&uh(m,u),r.has(d)||l.push(d)}}return i}function Ri(e,t,o){var l;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function ph(e,t){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===t.ref}),i=()=>e.entities.filter(r=>r.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function hh(e,t){const o=()=>e.attributes.filter(r=>r.name===t.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function gc(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function mt(e,t){const o=ph(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function yh(e,t){const o=hh(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function gh(e,t){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===t.ref),i=()=>e.attributes.filter(r=>r.name===t.ref).flatMap(r=>r.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function bh(e,t){const o=gh(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function bc(e,t){const o=e.filter(i=>i.physicalName===t.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function _h(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function kh(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Eh(e,t){const o=_h(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Nh(e,t){const o=kh(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function _c(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function kc(e,t,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let f=!1;for(const p of t.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=bc(un(i,a),g);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:_.matches}),f=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return f?null:{modelId:d,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}function wh(e,t,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,f)=>{const p=t.fields[f],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=bc(un(i,a),_);if(!b.ok){s.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Ec(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Nc(e,t,o,i,a,r){const l=[];let s=!1;for(const c of t.columns){const d=bh(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:t.name,unique:t.unique??!1,columns:l,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function vh(e,t,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=m=>a.find(f=>f.type===m),l=[],s=[],c=new Map,d=new Map,u=new Set;for(const m of t)m.kind==="entity.add"&&(u.add(m.spec.name),m.spec.physicalName&&u.add(m.spec.physicalName));return t.forEach((m,f)=>{var p,y,g,_;switch(m.kind){case"entity.add":{const b=i(),N={modelId:b,name:m.spec.name,stereotype:m.spec.stereotype??"JPA_ENTITY",attributes:[],...m.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...m.spec.physicalName?{table:{physicalName:m.spec.physicalName}}:{}},h={ref:m.spec.name};let k=!1;for(const[G,K]of(m.spec.attributes??[]).entries()){if(K.type==="GroupCodeEnum"&&!K.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0;continue}const v=r(K.type);if(v){const T=kc(K,v,G,N,e.entities,f,h,s,i);T?N.attributes.push(T):k=!0}else(p=K.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0):N.attributes.push(_c(K,G,i))}const P=(m.spec.operations??[]).map((G,K)=>Ec(G,K,i));P.length&&(N.operations=P);const A=[];for(const G of m.spec.indexes??[]){const K=Nc(N,G,f,h,s,i);K?A.push(K):k=!0}if(A.length&&(N.indexes=A),k)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:N});break}case"entity.update":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:m.patch});break}case"entity.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}if(m.spec.type==="GroupCodeEnum"&&!m.spec.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}const N=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,N+1);const h=r(m.spec.type);let k;if(h)k=kc(m.spec,h,N,b.value,e.entities,f,m.entity,s,i);else if((y=m.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}else k=_c(m.spec,N,i);if(!k)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:k});break}case"attribute.update":case"attribute.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=yh(b.value,m.attribute);if(!N.ok){s.push(N.reason==="not-found"?{code:"attribute-not-found",opIndex:f,entity:m.entity,handle:m.attribute}:{code:"attribute-ambiguous",opIndex:f,entity:m.entity,handle:m.attribute,matches:N.matches});break}if(m.kind==="attribute.update"){let h=m.patch;if((g=m.embeddableOverrides)!=null&&g.length){const k=r(N.value.type);if(!k||N.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:m.attribute});break}const P=wh(N.value,k,m.embeddableOverrides,b.value,e.entities,f,m.entity,s);if(!P)break;h={...m.patch,dbAttrs:P}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId,patch:h})}else l.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId});break}case"association.add":{const b=mt(e,m.spec.from),N=mt(e,m.spec.to);if(b.ok||s.push(ft(b.reason,f,m.spec.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.spec.to,N.matches,u)),!b.ok||!N.ok)break;if(m.spec.identifying&&b.value.modelId===N.value.modelId){s.push({code:"self-identifying",opIndex:f,handle:{from:m.spec.from,to:m.spec.to}});break}const h=i(),k={modelId:h,...m.spec.identifying!=null?{identifying:m.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:m.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:N.value.modelId,multiplicity:m.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:m.spec.composition??!1}},P={...e,associations:[...e.associations,k]},A=So(P,N.value.modelId,i);A.add[0]&&(k.end2.attributeRef=A.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:h,value:k});for(const G of A.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:N.value.modelId,entityRef:N.value.modelId,value:G});break}case"association.remove":{const b=mt(e,m.association.from),N=mt(e,m.association.to);if(b.ok||s.push(ft(b.reason,f,m.association.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.association.to,N.matches,u)),!b.ok||!N.ok)break;const h=gc(e,b.value.modelId,N.value.modelId);if(h.length!==1){s.push(h.length===0?{code:"association-not-found",opIndex:f,handle:m.association}:{code:"association-ambiguous",opIndex:f,handle:m.association,matches:h.map(k=>k.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const b=wc(e,m.association,f,s,u);if(!b)break;l.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:m.patch});break}case"associationEnd.update":{const b=wc(e,m.association,f,s,u);if(!b)break;const N=m.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:N,patch:m.patch});break}case"index.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nc(b.value,m.spec,f,m.entity,s,i);if(!N)break;l.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.modelId,value:N});break}case"index.update":case"index.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Eh(b.value,m.index);if(!N.ok){s.push(N.reason==="not-found"?{code:"index-not-found",opIndex:f,entity:m.entity,handle:m.index}:{code:"index-ambiguous",opIndex:f,entity:m.entity,handle:m.index,matches:N.matches});break}if(m.kind==="index.update"){if("columns"in m.patch){s.push({code:"index-columns-patch-unsupported",opIndex:f,entity:m.entity,handle:m.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId,patch:m.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId});break}case"operation.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=d.get(b.value.modelId)??((_=b.value.operations)==null?void 0:_.length)??0;d.set(b.value.modelId,N+1);const h=Ec(m.spec,N,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nh(b.value,m.operation);if(!N.ok){s.push(N.reason==="not-found"?{code:"operation-not-found",opIndex:f,entity:m.entity,handle:m.operation}:{code:"operation-ambiguous",opIndex:f,entity:m.entity,handle:m.operation,matches:N.matches});break}m.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId,patch:m.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId});break}case"group.add":{const b=[];let N=!1;for(const P of m.spec.members){const A=mt(e,P);if(!A.ok){s.push(ft(A.reason,f,P,A.matches,u)),N=!0;continue}b.push(A.value.modelId)}if(N)break;const h=i(),k={modelId:h,excludeDDLGeneration:m.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...m.spec.name?{name:m.spec.name}:{},...m.spec.packageName?{packageName:m.spec.packageName}:{},...m.spec.description?{description:m.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:h,value:k});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function ft(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function wc(e,t,o,i,a){const r=mt(e,t.from),l=mt(e,t.to);if(r.ok||i.push(ft(r.reason,o,t.from,r.matches,a)),l.ok||i.push(ft(l.reason,o,t.to,l.matches,a)),!r.ok||!l.ok)return null;const s=gc(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const vc={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xh={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ih={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},Ai={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Ch={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...Ai,description:"속성 설명(다국어)."},columnLogicalName:{...Ai,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},Sh={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},xc={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},$h={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...xc,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...xc,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},Rh={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...vc,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},Ah={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Ai,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Th={type:"object",properties:{name:{...Ai,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},Vh={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function lt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Mh={"entity.add":lt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":lt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":lt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":lt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":lt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":lt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":lt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":lt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":lt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":lt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":lt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":lt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":lt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":lt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":lt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":lt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":lt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Ic={anyOf:hc.map(e=>Mh[e])},Bh={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:vc,assocHandle:xh,entitySpec:Ih,attrSpec:Ch,embeddableOverrides:Sh,assocSpec:$h,indexSpec:Rh,operationSpec:Ah,groupSpec:Th,patch:Vh,symbolicOp:Ic}};function Dh(e,t,o,i={}){const a=i.mkClientOpId??De,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Cc={location:{x:0,y:0},size:{width:220,height:140}};function Sc(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Oh=/^[-=_*~\s]{3,}$/;function Lh(e){return e.attrType&&e.attrType!=="NORMAL"||!Oh.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Ph(e){return e.type===Rt&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function zh(e,t){if(e.attrType==="DIVIDER"||Lh(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Ph(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Sc)}}function Uh(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:r,order:l,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:r?{ko:r}:void 0,order:l??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Fh(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function Hh(e){var t,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(zh),operations:(t=e.operations)==null?void 0:t.map(Uh),indexes:(o=e.indexes)==null?void 0:o.map(Fh),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Gh(e){const t={};for(const i of e.attributes)i.style&&(t[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...Cc},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function $c(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function hr(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:$c(e)}}function jh(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:hr(e.end1),end2:hr(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:t,layout:o}}function Rc(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ac(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Tc(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Vc(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Sc)}}function Kh(e,t,o){var _,b;const i=Rc(e.end1.attribute),a=Rc(e.end2.attribute);if(i===a)return jh(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(b=(_=s.dbAttrs)==null?void 0:_[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(l.endModel.refId),m=u?u.attributes.reduce((N,h)=>Math.max(N,h.order),-1)+1:s.order??0,f={...Vc(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(f);const p=(N,h)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:h?d:f.modelId,legacyNavRaw:h?void 0:N.attribute,jpa:$c(N)}),y={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:g}}function Yh(e,t){const o=e.targetModelId?t.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function Wh(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=t.get(r.endModel.refId),c=s?s.attributes.reduce((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...Vc(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yh(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...hr(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},f=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:f?d.modelId:void 0,targetColumnRef:f?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function qh(e,t){var i,a,r,l;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Mc(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=qh(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Bc(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(t.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Xh(e){return(e.schemaVersion??1)>=2&&"logical"in e?Jh(e):Zh(e)}function Jh(e){const t=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:f,...p}=m;return f!=null&&(o[m.modelId]=f),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i),{version:s,...c}=e.layout;Bc(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Zh(e){var b,N;const t=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,k)=>{o.push(Hh(h));const P=Gh(h);P.geo={location:{x:P.geo.location.x+k.x,y:P.geo.location.y+k.y},size:P.geo.size},i.push(P);for(const A of h.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const k=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:k.map(A=>A.modelId)});const P=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const A=(h.notes??[]).map(G=>G.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:A.length?A:void 0})}for(const A of k)d(A,P);for(const A of h.notes??[])m.push(Mc(A,P))}const f=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const k of h.attributes)for(const P of k.dbAttrs)p.set(P.modelId,k.modelId),y.set(P.modelId,P);for(const h of c)for(const k of[h.end1,h.end2]){const P=k.attribute;if(P&&(((N=P.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of P.dbAttrs)A.modelId&&p.set(A.modelId,P.modelId)}for(const h of c){const k=Ac(h.end1.attribute),P=Ac(h.end2.attribute),A=Tc(h.end1)||Tc(h.end2),{assoc:G,layout:K}=k!==P||A?Wh(h,f,y):Kh(h,f,p);a.push(G),r.push(K)}Bc(o,a,r),bs(o);const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Mc(h)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function Dc(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Qh(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Dc),style:t}}function ey(e,t){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:t}}function ty(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function tn(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function ny(e,t){const o=t==null?void 0:t.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...Dc(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function oy(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function iy(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function ay(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function ry(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:ay(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function ly(e,t,o){let i;for(const m of t.logical.entities){const f=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(f){i=f;break}}if(!i)return;const a=i.embedded.embeddableRef,r=t.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,f)=>ry(m,l[f]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:tn(e.end1,c?s:u),end2:tn(e.end2,c?u:s)}}function sy(e,t,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:tn(e.end1,e.end1.legacyEmbedRaw),end2:tn(e.end2,e.end2.legacyEmbedRaw)};const a=ly(e,t,i);if(a)return a;const r=!!e.end1.legacyNavRaw,l=!!e.end2.legacyNavRaw;if(r!==l){const s=r?e.end1:e.end2,c=r?e.end2:e.end1,d=t.logical.entities.find(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),m=t.logical.entities.find(y=>y.modelId===c.entityRef),f=u?ny(u,m):void 0,p=s.legacyNavRaw;return{...i,end1:tn(e.end1,r?p:f),end2:tn(e.end2,l?p:f)}}return{...i,end1:tn(e.end1),end2:tn(e.end2)}}function Oc(e,t,o,i,a={x:0,y:0}){var u,m;const r=t.layout.entityLayouts.find(f=>f.entityRef===e.modelId),l=t.logical.associations.filter(f=>f.end1.entityRef===e.modelId),s=f=>t.layout.associationLayouts.find(p=>p.associationRef===f),c=(r==null?void 0:r.geo)??{...Cc},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(f=>!o.has(f.modelId)&&!i.has(f.modelId)).map(f=>{var p;return Qh(f,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[f.modelId])}),operations:(u=e.operations)==null?void 0:u.map(f=>{var p;return ey(f,(p=r==null?void 0:r.operationStyles)==null?void 0:p[f.modelId])}),ownedAssociations:l.map(f=>sy(f,t,s(f.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(ty),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function cy(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Lc(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Oc(c,t,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Lc(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function dy(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=oy(e),r=iy(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>Oc(s,e,a,r)),groups:e.logical.groups.map(s=>cy(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Lc(s))}}function uy(e,t={}){var a,r,l;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((r=t.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=t.revSeed)==null?void 0:l.layoutVersion)??0}}}function $o(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ft(e){return typeof e=="function"?e():n.unref(e)}const my=typeof window<"u"&&typeof document<"u",fy=e=>typeof e<"u",py=Object.prototype.toString,hy=e=>py.call(e)==="[object Object]",yy=()=>{};function gy(e,t){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(r)})}return o}const Pc=e=>e();function by(e=Pc){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...r)=>{t.value&&e(...r)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function zc(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function _y(e,t,o={}){const{eventFilter:i=Pc,...a}=o;return n.watch(e,gy(i,t),a)}function qn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=by(i);return{stop:_y(e,t,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function ky(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=Ft(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function yr(e,t=!1){function o(m,{flush:f="sync",deep:p=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(h=>{_=n.watch(e,k=>{m(k)!==t&&(_==null||_(),h(k))},{flush:f,deep:p,immediate:!0})})];return y!=null&&N.push(zc(y,g).then(()=>Ft(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,f){if(!n.isRef(m))return o(k=>k===m,f);const{flush:p="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=f??{};let b=null;const h=[new Promise(k=>{b=n.watch([e,m],([P,A])=>{t!==(P===A)&&(b==null||b(),k(P))},{flush:p,deep:y,immediate:!0})})];return g!=null&&h.push(zc(g,_).then(()=>Ft(e)).finally(()=>(b==null||b(),Ft(e)))),Promise.race(h)}function a(m){return o(f=>!!f,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,f){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(Ft(m))},f)}function d(m){return u(1,m)}function u(m=1,f){let p=-1;return o(()=>(p+=1,p>=m),f)}return Array.isArray(Ft(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return yr(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return yr(e,!t)}}}function gr(e){return yr(e)}function Ey(e){var t;const o=Ft(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Uc=my?window:void 0;function Fc(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Uc):[t,o,i,a]=e,!t)return yy;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,f,p)=>(u.addEventListener(m,f,p),()=>u.removeEventListener(m,f,p)),c=n.watch(()=>[Ey(t),Ft(a)],([u,m])=>{if(l(),!u)return;const f=hy(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return $o(d),d}function Ny(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Hc(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=Uc,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=Ny(t);return Fc(a,r,u=>{u.repeat&&Ft(s)||c(u)&&o(u)},l)}function wy(e){return JSON.parse(JSON.stringify(e))}function br(e,t,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:f}=i,p=n.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const _=h=>s?typeof s=="function"?s(h):wy(h):h,b=()=>fy(e[t])?_(e[t]):m,N=h=>{f?f(h)&&y(g,h):y(g,h)};if(c){const h=b(),k=n.ref(h);let P=!1;return n.watch(()=>e[t],A=>{P||(P=!0,k.value=_(A),n.nextTick(()=>P=!1))}),n.watch(k,A=>{!P&&(A!==e[t]||u)&&N(A)},{deep:u}),k}else return n.computed({get(){return b()},set(h){N(h)}})}var vy={value:()=>{}};function Ti(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Vi(o)}function Vi(e){this._=e}function xy(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Vi.prototype=Ti.prototype={constructor:Vi,on:function(e,t){var o=this._,i=xy(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Iy(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Gc(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Gc(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Vi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(t,o)}};function Iy(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Gc(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=vy,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var _r="http://www.w3.org/1999/xhtml";const jc={svg:"http://www.w3.org/2000/svg",xhtml:_r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),jc.hasOwnProperty(t)?{space:jc[t],local:e}:e}function Cy(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===_r&&t.documentElement.namespaceURI===_r?t.createElement(e):t.createElementNS(o,e)}}function Sy(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Kc(e){var t=Mi(e);return(t.local?Sy:Cy)(t)}function $y(){}function kr(e){return e==null?$y:function(){return this.querySelector(e)}}function Ry(e){typeof e!="function"&&(e=kr(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new kt(i,this._parents)}function Ay(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ty(){return[]}function Yc(e){return e==null?Ty:function(){return this.querySelectorAll(e)}}function Vy(e){return function(){return Ay(e.apply(this,arguments))}}function My(e){typeof e=="function"?e=Vy(e):e=Yc(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new kt(i,a)}function Wc(e){return function(){return this.matches(e)}}function qc(e){return function(t){return t.matches(e)}}var By=Array.prototype.find;function Dy(e){return function(){return By.call(this.children,e)}}function Oy(){return this.firstElementChild}function Ly(e){return this.select(e==null?Oy:Dy(typeof e=="function"?e:qc(e)))}var Py=Array.prototype.filter;function zy(){return Array.from(this.children)}function Uy(e){return function(){return Py.call(this.children,e)}}function Fy(e){return this.selectAll(e==null?zy:Uy(typeof e=="function"?e:qc(e)))}function Hy(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new kt(i,this._parents)}function Xc(e){return new Array(e.length)}function Gy(){return new kt(this._enter||this._groups.map(Xc),this._parents)}function Bi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bi.prototype={constructor:Bi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function jy(e){return function(){return e}}function Ky(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Bi(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Yy(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Bi(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Wy(e){return e.__data__}function qy(e,t){if(!arguments.length)return Array.from(this,Wy);var o=t?Yy:Ky,i=this._parents,a=this._groups;typeof e!="function"&&(e=jy(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],f=m.length,p=Xy(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new kt(l,i),l._enter=s,l._exit=c,l}function Xy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Jy(){return new kt(this._exit||this._groups.map(Xc),this._parents)}function Zy(e,t,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Qy(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new kt(s,this._parents)}function eg(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function tg(e){e||(e=ng);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(t)}return new kt(a,this._parents).order()}function ng(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function og(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ig(){return Array.from(this)}function ag(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function rg(){let e=0;for(const t of this)++e;return e}function lg(){return!this.node()}function sg(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function cg(e){return function(){this.removeAttribute(e)}}function dg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ug(e,t){return function(){this.setAttribute(e,t)}}function mg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fg(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function pg(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function hg(e,t){var o=Mi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?dg:cg:typeof t=="function"?o.local?pg:fg:o.local?mg:ug)(o,t))}function Jc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yg(e){return function(){this.style.removeProperty(e)}}function gg(e,t,o){return function(){this.style.setProperty(e,t,o)}}function bg(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function _g(e,t,o){return arguments.length>1?this.each((t==null?yg:typeof t=="function"?bg:gg)(e,t,o??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Jc(e).getComputedStyle(e,null).getPropertyValue(t)}function kg(e){return function(){delete this[e]}}function Eg(e,t){return function(){this[e]=t}}function Ng(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function wg(e,t){return arguments.length>1?this.each((t==null?kg:typeof t=="function"?Ng:Eg)(e,t)):this.node()[e]}function Zc(e){return e.trim().split(/^|\s+/)}function Er(e){return e.classList||new Qc(e)}function Qc(e){this._node=e,this._names=Zc(e.getAttribute("class")||"")}Qc.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ed(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function td(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function vg(e){return function(){ed(this,e)}}function xg(e){return function(){td(this,e)}}function Ig(e,t){return function(){(t.apply(this,arguments)?ed:td)(this,e)}}function Cg(e,t){var o=Zc(e+"");if(arguments.length<2){for(var i=Er(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Ig:t?vg:xg)(o,t))}function Sg(){this.textContent=""}function $g(e){return function(){this.textContent=e}}function Rg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ag(e){return arguments.length?this.each(e==null?Sg:(typeof e=="function"?Rg:$g)(e)):this.node().textContent}function Tg(){this.innerHTML=""}function Vg(e){return function(){this.innerHTML=e}}function Mg(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Bg(e){return arguments.length?this.each(e==null?Tg:(typeof e=="function"?Mg:Vg)(e)):this.node().innerHTML}function Dg(){this.nextSibling&&this.parentNode.appendChild(this)}function Og(){return this.each(Dg)}function Lg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pg(){return this.each(Lg)}function zg(e){var t=typeof e=="function"?e:Kc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ug(){return null}function Fg(e,t){var o=typeof e=="function"?e:Kc(e),i=t==null?Ug:typeof t=="function"?t:kr(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Hg(){var e=this.parentNode;e&&e.removeChild(this)}function Gg(){return this.each(Hg)}function jg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yg(e){return this.select(e?Kg:jg)}function Wg(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qg(e){return function(t){e.call(this,t,this.__data__)}}function Xg(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Jg(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Zg(e,t,o){return function(){var i=this.__on,a,r=qg(t);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Qg(e,t,o){var i=Xg(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=t?Zg:Jg,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function nd(e,t,o){var i=Jc(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function eb(e,t){return function(){return nd(this,e,t)}}function tb(e,t){return function(){return nd(this,e,t.apply(this,arguments))}}function nb(e,t){return this.each((typeof t=="function"?tb:eb)(e,t))}function*ob(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var od=[null];function kt(e,t){this._groups=e,this._parents=t}function Ro(){return new kt([[document.documentElement]],od)}function ib(){return this}kt.prototype=Ro.prototype={constructor:kt,select:Ry,selectAll:My,selectChild:Ly,selectChildren:Fy,filter:Hy,data:qy,enter:Gy,exit:Jy,join:Zy,merge:Qy,selection:ib,order:eg,sort:tg,call:og,nodes:ig,node:ag,size:rg,empty:lg,each:sg,attr:hg,style:_g,property:wg,classed:Cg,text:Ag,html:Bg,raise:Og,lower:Pg,append:zg,insert:Fg,remove:Gg,clone:Yg,datum:Wg,on:Qg,dispatch:nb,[Symbol.iterator]:ob};function vt(e){return typeof e=="string"?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],od)}function ab(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Vt(e,t){if(e=ab(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const rb={passive:!1},Ao={capture:!0,passive:!1};function Nr(e){e.stopImmediatePropagation()}function Jn(e){e.preventDefault(),e.stopImmediatePropagation()}function id(e){var t=e.document.documentElement,o=vt(e).on("dragstart.drag",Jn,Ao);"onselectstart"in t?o.on("selectstart.drag",Jn,Ao):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ad(e,t){var o=e.document.documentElement,i=vt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Jn,Ao),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const Di=e=>()=>e;function wr(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}wr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lb(e){return!e.ctrlKey&&!e.button}function sb(){return this.parentNode}function cb(e,t){return t??{x:e.x,y:e.y}}function db(){return navigator.maxTouchPoints||"ontouchstart"in this}function ub(){var e=lb,t=sb,o=cb,i=db,a={},r=Ti("start","drag","end"),l=0,s,c,d,u,m=0;function f(k){k.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",b,rb).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(k,P){if(!(u||!e.call(this,k,P))){var A=h(this,t.call(this,k,P),k,P,"mouse");A&&(vt(k.view).on("mousemove.drag",y,Ao).on("mouseup.drag",g,Ao),id(k.view),Nr(k),d=!1,s=k.clientX,c=k.clientY,A("start",k))}}function y(k){if(Jn(k),!d){var P=k.clientX-s,A=k.clientY-c;d=P*P+A*A>m}a.mouse("drag",k)}function g(k){vt(k.view).on("mousemove.drag mouseup.drag",null),ad(k.view,d),Jn(k),a.mouse("end",k)}function _(k,P){if(e.call(this,k,P)){var A=k.changedTouches,G=t.call(this,k,P),K=A.length,v,T;for(v=0;v<K;++v)(T=h(this,G,k,P,A[v].identifier,A[v]))&&(Nr(k),T("start",k,A[v]))}}function b(k){var P=k.changedTouches,A=P.length,G,K;for(G=0;G<A;++G)(K=a[P[G].identifier])&&(Jn(k),K("drag",k,P[G]))}function N(k){var P=k.changedTouches,A=P.length,G,K;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),G=0;G<A;++G)(K=a[P[G].identifier])&&(Nr(k),K("end",k,P[G]))}function h(k,P,A,G,K,v){var T=r.copy(),H=Vt(v||A,P),C,ae,E;if((E=o.call(k,new wr("beforestart",{sourceEvent:A,target:f,identifier:K,active:l,x:H[0],y:H[1],dx:0,dy:0,dispatch:T}),G))!=null)return C=E.x-H[0]||0,ae=E.y-H[1]||0,function Y(S,W,ee){var ie=H,O;switch(S){case"start":a[K]=Y,O=l++;break;case"end":delete a[K],--l;case"drag":H=Vt(ee||W,P),O=l;break}T.call(S,k,new wr(S,{sourceEvent:W,subject:E,target:f,identifier:K,active:O,x:H[0]+C,y:H[1]+ae,dx:H[0]-ie[0],dy:H[1]-ie[1],dispatch:T}),G)}}return f.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Di(!!k),f):e},f.container=function(k){return arguments.length?(t=typeof k=="function"?k:Di(k),f):t},f.subject=function(k){return arguments.length?(o=typeof k=="function"?k:Di(k),f):o},f.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:Di(!!k),f):i},f.on=function(){var k=r.on.apply(r,arguments);return k===r?f:k},f.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,f):Math.sqrt(m)},f}function vr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function rd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function To(){}var Vo=.7,Oi=1/Vo,Zn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mb=/^#([0-9a-f]{3,8})$/,fb=new RegExp(`^rgb\\(${Zn},${Zn},${Zn}\\)$`),pb=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),hb=new RegExp(`^rgba\\(${Zn},${Zn},${Zn},${Mo}\\)$`),yb=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${Mo}\\)$`),gb=new RegExp(`^hsl\\(${Mo},${Mt},${Mt}\\)$`),bb=new RegExp(`^hsla\\(${Mo},${Mt},${Mt},${Mo}\\)$`),ld={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vr(To,bn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sd,formatHex:sd,formatHex8:_b,formatHsl:kb,formatRgb:cd,toString:cd});function sd(){return this.rgb().formatHex()}function _b(){return this.rgb().formatHex8()}function kb(){return pd(this).formatHsl()}function cd(){return this.rgb().formatRgb()}function bn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=mb.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?dd(t):o===3?new ht(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Li(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Li(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fb.exec(e))?new ht(t[1],t[2],t[3],1):(t=pb.exec(e))?new ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hb.exec(e))?Li(t[1],t[2],t[3],t[4]):(t=yb.exec(e))?Li(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gb.exec(e))?fd(t[1],t[2]/100,t[3]/100,1):(t=bb.exec(e))?fd(t[1],t[2]/100,t[3]/100,t[4]):ld.hasOwnProperty(e)?dd(ld[e]):e==="transparent"?new ht(NaN,NaN,NaN,0):null}function dd(e){return new ht(e>>16&255,e>>8&255,e&255,1)}function Li(e,t,o,i){return i<=0&&(e=t=o=NaN),new ht(e,t,o,i)}function Eb(e){return e instanceof To||(e=bn(e)),e?(e=e.rgb(),new ht(e.r,e.g,e.b,e.opacity)):new ht}function xr(e,t,o,i){return arguments.length===1?Eb(e):new ht(e,t,o,i??1)}function ht(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}vr(ht,xr,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ht(_n(this.r),_n(this.g),_n(this.b),Pi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ud,formatHex:ud,formatHex8:Nb,formatRgb:md,toString:md}));function ud(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}`}function Nb(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}${kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function md(){const e=Pi(this.opacity);return`${e===1?"rgb(":"rgba("}${_n(this.r)}, ${_n(this.g)}, ${_n(this.b)}${e===1?")":`, ${e})`}`}function Pi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kn(e){return e=_n(e),(e<16?"0":"")+e.toString(16)}function fd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new xt(e,t,o,i)}function pd(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof To||(e=bn(e)),!e)return new xt;if(e instanceof xt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new xt(l,s,c,e.opacity)}function wb(e,t,o,i){return arguments.length===1?pd(e):new xt(e,t,o,i??1)}function xt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}vr(xt,wb,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new xt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ht(Ir(e>=240?e-240:e+120,a,i),Ir(e,a,i),Ir(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new xt(hd(this.h),zi(this.s),zi(this.l),Pi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Pi(this.opacity);return`${e===1?"hsl(":"hsla("}${hd(this.h)}, ${zi(this.s)*100}%, ${zi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hd(e){return e=(e||0)%360,e<0?e+360:e}function zi(e){return Math.max(0,Math.min(1,e||0))}function Ir(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Cr=e=>()=>e;function vb(e,t){return function(o){return e+o*t}}function xb(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Ib(e){return(e=+e)==1?yd:function(t,o){return o-t?xb(t,o,e):Cr(isNaN(t)?o:t)}}function yd(e,t){var o=t-e;return o?vb(e,o):Cr(isNaN(e)?t:e)}const Ui=(function e(t){var o=Ib(t);function i(a,r){var l=o((a=xr(a)).r,(r=xr(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=yd(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Cb(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+t[a]*r;return i}}function Sb(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $b(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=Bo(e[l],t[l]);for(;l<o;++l)r[l]=t[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function Rb(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Bt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ab(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=Bo(e[a],t[a]):i[a]=t[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Sr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$r=new RegExp(Sr.source,"g");function Tb(e){return function(){return e}}function Vb(e){return function(t){return e(t)+""}}function gd(e,t){var o=Sr.lastIndex=$r.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Sr.exec(e))&&(a=$r.exec(t));)(r=a.index)>o&&(r=t.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Bt(i,a)})),o=$r.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?Vb(c[0].x):Tb(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function Bo(e,t){var o=typeof t,i;return t==null||o==="boolean"?Cr(t):(o==="number"?Bt:o==="string"?(i=bn(t))?(t=i,Ui):gd:t instanceof bn?Ui:t instanceof Date?Rb:Sb(t)?Cb:Array.isArray(t)?$b:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ab:Bt)(e,t)}var bd=180/Math.PI,Rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _d(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*bd,skewX:Math.atan(c)*bd,scaleX:l,scaleY:s}}var Fi;function Mb(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rr:_d(t.a,t.b,t.c,t.d,t.e,t.f)}function Bb(e){return e==null||(Fi||(Fi=document.createElementNS("http://www.w3.org/2000/svg","g")),Fi.setAttribute("transform",e),!(e=Fi.transform.baseVal.consolidate()))?Rr:(e=e.matrix,_d(e.a,e.b,e.c,e.d,e.e,e.f))}function kd(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Bt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Bt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var Db=kd(Mb,"px, ","px)","deg)"),Ob=kd(Bb,", ",")",")"),Lb=1e-12;function Ed(e){return((e=Math.exp(e))+1/e)/2}function Pb(e){return((e=Math.exp(e))-1/e)/2}function zb(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hi=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<Lb)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Ed(P),T=d/(o*N)*(v*zb(t*K+P)-Pb(P));return[s+T*p,c+T*y,d*v/Ed(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Qn=0,Do=0,Oo=0,Nd=1e3,Gi,Lo,ji=0,En=0,Ki=0,Po=typeof performance=="object"&&performance.now?performance:Date,wd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ar(){return En||(wd(Ub),En=Po.now()+Ki)}function Ub(){En=0}function Yi(){this._call=this._time=this._next=null}Yi.prototype=vd.prototype={constructor:Yi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ar():+o)+(t==null?0:+t),!this._next&&Lo!==this&&(Lo?Lo._next=this:Gi=this,Lo=this),this._call=e,this._time=o,Tr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tr())}};function vd(e,t,o){var i=new Yi;return i.restart(e,t,o),i}function Fb(){Ar(),++Qn;for(var e=Gi,t;e;)(t=En-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qn}function xd(){En=(ji=Po.now())+Ki,Qn=Do=0;try{Fb()}finally{Qn=0,Gb(),En=0}}function Hb(){var e=Po.now(),t=e-ji;t>Nd&&(Ki-=t,ji=e)}function Gb(){for(var e,t=Gi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Gi=o);Lo=e,Tr(i)}function Tr(e){if(!Qn){Do&&(Do=clearTimeout(Do));var t=e-En;t>24?(e<1/0&&(Do=setTimeout(xd,e-Po.now()-Ki)),Oo&&(Oo=clearInterval(Oo))):(Oo||(ji=Po.now(),Oo=setInterval(Hb,Nd)),Qn=1,wd(xd))}}function Id(e,t,o){var i=new Yi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var jb=Ti("start","end","cancel","interrupt"),Kb=[],Cd=0,Sd=1,Vr=2,Wi=3,$d=4,Mr=5,qi=6;function Xi(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;Yb(e,o,{name:t,index:i,group:a,on:jb,tween:Kb,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Cd})}function Br(e,t){var o=It(e,t);if(o.state>Cd)throw new Error("too late; already scheduled");return o}function Dt(e,t){var o=It(e,t);if(o.state>Wi)throw new Error("too late; already running");return o}function It(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Yb(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=vd(r,0,o.time);function r(d){o.state=Sd,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Sd)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Wi)return Id(l);p.state===$d?(p.state=qi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=qi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Id(function(){o.state===Wi&&(o.state=$d,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Vr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Vr){for(o.state=Wi,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Mr,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===Mr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ji(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Vr&&i.state<Mr,i.state=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function Wb(e){return this.each(function(){Ji(this,e)})}function qb(e,t){var o,i;return function(){var a=Dt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function Xb(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Dt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function Jb(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=It(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((t==null?qb:Xb)(o,e,t))}function Dr(e,t,o){var i=e._id;return e.each(function(){var a=Dt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return It(a,i).value[t]}}function Rd(e,t){var o;return(typeof t=="number"?Bt:t instanceof bn?Ui:(o=bn(t))?(t=o,Ui):gd)(e,t)}function Zb(e){return function(){this.removeAttribute(e)}}function Qb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function e_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function t_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function n_(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function o_(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function i_(e,t){var o=Mi(e),i=o==="transform"?Ob:Rd;return this.attrTween(e,typeof t=="function"?(o.local?o_:n_)(o,i,Dr(this,"attr."+e,t)):t==null?(o.local?Qb:Zb)(o):(o.local?t_:e_)(o,i,t))}function a_(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function r_(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function l_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&r_(e,r)),o}return a._value=t,a}function s_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&a_(e,r)),o}return a._value=t,a}function c_(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Mi(e);return this.tween(o,(i.local?l_:s_)(i,t))}function d_(e,t){return function(){Br(this,e).delay=+t.apply(this,arguments)}}function u_(e,t){return t=+t,function(){Br(this,e).delay=t}}function m_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d_:u_)(t,e)):It(this.node(),t).delay}function f_(e,t){return function(){Dt(this,e).duration=+t.apply(this,arguments)}}function p_(e,t){return t=+t,function(){Dt(this,e).duration=t}}function h_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?f_:p_)(t,e)):It(this.node(),t).duration}function y_(e,t){if(typeof t!="function")throw new Error;return function(){Dt(this,e).ease=t}}function g_(e){var t=this._id;return arguments.length?this.each(y_(t,e)):It(this.node(),t).ease}function b_(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Dt(this,e).ease=o}}function __(e){if(typeof e!="function")throw new Error;return this.each(b_(this._id,e))}function k_(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ht(i,this._parents,this._name,this._id)}function E_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Ht(l,this._parents,this._name,this._id)}function N_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function w_(e,t,o){var i,a,r=N_(t)?Br:Dt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function v_(e,t){var o=this._id;return arguments.length<2?It(this.node(),o).on.on(e):this.each(w_(o,e,t))}function x_(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function I_(){return this.on("end.remove",x_(this._id))}function C_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=kr(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Xi(d[f],t,o,f,d,It(u,o)));return new Ht(r,this._parents,t,o)}function S_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Yc(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var f=e.call(u,u.__data__,m,c),p,y=It(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Xi(p,t,o,g,f,y);r.push(f),l.push(u)}return new Ht(r,l,t,o)}var $_=Ro.prototype.constructor;function R_(){return new $_(this._groups,this._parents)}function A_(e,t){var o,i,a;return function(){var r=Xn(this,e),l=(this.style.removeProperty(e),Xn(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Ad(e){return function(){this.style.removeProperty(e)}}function T_(e,t,o){var i,a=o+"",r;return function(){var l=Xn(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function V_(e,t,o){var i,a,r;return function(){var l=Xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function M_(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Dt(this,e),d=c.on,u=c.value[r]==null?s||(s=Ad(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function B_(e,t,o){var i=(e+="")=="transform"?Db:Rd;return t==null?this.styleTween(e,A_(e,i)).on("end.style."+e,Ad(e)):typeof t=="function"?this.styleTween(e,V_(e,i,Dr(this,"style."+e,t))).each(M_(this._id,e)):this.styleTween(e,T_(e,i,t),o).on("end.style."+e,null)}function D_(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function O_(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&D_(e,l,o)),i}return r._value=t,r}function L_(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,O_(e,t,o??""))}function P_(e){return function(){this.textContent=e}}function z_(e){return function(){var t=e(this);this.textContent=t??""}}function U_(e){return this.tween("text",typeof e=="function"?z_(Dr(this,"text",e)):P_(e==null?"":e+""))}function F_(e){return function(t){this.textContent=e.call(this,t)}}function H_(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&F_(a)),t}return i._value=e,i}function G_(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,H_(e))}function j_(){for(var e=this._name,t=this._id,o=Td(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=It(c,t);Xi(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ht(i,this._parents,e,o)}function K_(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Dt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var Y_=0;function Ht(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Td(){return++Y_}var Gt=Ro.prototype;Ht.prototype={constructor:Ht,select:C_,selectAll:S_,selectChild:Gt.selectChild,selectChildren:Gt.selectChildren,filter:k_,merge:E_,selection:R_,transition:j_,call:Gt.call,nodes:Gt.nodes,node:Gt.node,size:Gt.size,empty:Gt.empty,each:Gt.each,on:v_,attr:i_,attrTween:c_,style:B_,styleTween:L_,text:U_,textTween:G_,remove:I_,tween:Jb,delay:m_,duration:h_,ease:g_,easeVarying:__,end:K_,[Symbol.iterator]:Gt[Symbol.iterator]};function W_(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var q_={time:null,delay:0,duration:250,ease:W_};function X_(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function J_(e){var t,o;e instanceof Ht?(t=e._id,e=e._name):(t=Td(),(o=q_).time=Ar(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Xi(c,e,t,d,l,o||X_(c,t));return new Ht(i,this._parents,e,t)}Ro.prototype.interrupt=Wb,Ro.prototype.transition=J_;const Zi=e=>()=>e;function Z_(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function jt(e,t,o){this.k=e,this.x=t,this.y=o}jt.prototype={constructor:jt,scale:function(e){return e===1?this:new jt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eo=new jt(1,0,0);jt.prototype;function Or(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function Q_(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function e1(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Vd(){return this.__zoom||eo}function t1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function n1(){return navigator.maxTouchPoints||"ontouchstart"in this}function o1(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function i1(){var e=Q_,t=e1,o=o1,i=t1,a=n1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Hi,d=Ti("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",Vd).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",Vd),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(eo.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new jt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new jt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new jt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=vt(this.that).datum();d.call(E,this.that,new Z_(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=Vt(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ji(this),S.start()}zo(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=vt(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=Vt(E,S),O=E.clientX,U=E.clientY;id(E.view),Or(E),W.mouse=[ie,this.__zoom.invert(ie)],Ji(this),W.start();function ne(ge){if(zo(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Vt(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),ad(ge.view,W.moved),zo(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=Vt(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);zo(E),s>0?vt(this).transition().duration(s).call(P,O,W,E):vt(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Or(E),O=0;O<W;++O)U=S[O],ne=Vt(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ji(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(zo(E),ie=0;ie<ee;++ie)O=W[ie],U=Vt(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Or(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=Vt(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=vt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Zi(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Zi(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Zi(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Zi([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}var Re=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Re||{}),Lr=(e=>(e.Partial="partial",e.Full="full",e))(Lr||{}),Nn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Nn||{}),Kt=(e=>(e.Strict="strict",e.Loose="loose",e))(Kt||{}),Pr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Pr||{}),Uo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{}),Md=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(Md||{});const a1=["INPUT","SELECT","TEXTAREA"],r1=typeof document<"u"?document:null;function zr(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return a1.includes(i==null?void 0:i.nodeName)||a||!!r}function l1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Bd(e,t,o,i){const a=t.replace("+",`
3
24
  `).replace(`
4
25
 
5
26
  `,`
6
27
  +`).split(`
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 Vg(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=Ag(o.code,e);return Array.isArray(e)?e.some(a=>fc(o[i],a,t,o.type==="keyup")):fc(o[i],e,t,o.type==="keyup")}}function Ag(e,t){return t.includes(e)?"code":"key"}function mo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??Cg),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}),_s(["blur","contextmenu"],s),ws((...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=Rg(d),(!a||a&&!p)&&Za(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}),ws((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Za(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"?Vg(d,l):d}return i}const mc="vue-flow__node-desc",pc="vue-flow__edge-desc",Tg="vue-flow__aria-live",hc=["Enter"," ","Escape"],An={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function yi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function gi(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 bi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function sn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function yc(e,t){return{x:sn(e.x,t[0][0],t[1][0]),y:sn(e.y,t[0][1],t[1][1])}}function gc(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 _i(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Mg(e){return _i(e.width)&&_i(e.height)&&_i(e.x)&&_i(e.y)}function Bg(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 bc(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 _c(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 Dg(...e){if(e.length===3){const[l,r,s]=e;return _c(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 Og(...e){if(e.length===3){const[l,r,s]=e;return _c(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 wc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Lg(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?vi(s,r):s}function vc(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 wi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function kc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function Pg(e,t){return kc(vc(wi(e),wi(t)))}function Ja(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=vc(t,wi({...i.computedPosition,...i.dimensions}))}return kc(t)}function Ec(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=gi(l,yi(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 zg(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 Ug(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 Nc(e,t,o,i,a,l=.1){const r=zg(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=Ug(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 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 $c(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:$c(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 Qa(e){const t=e.ctrlKey&&bo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function xc(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 Ic(e,t,o=15,i=40){const a=xc(e.x,i,t.width-i)*o,l=xc(e.y,i,t.height-i)*o;return[a,l]}function el(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 Sc(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)&&el(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?el(r,c):n.nextTick(()=>{el(r,c)}))}break}return t}function Ft(e,t){return{id:e,type:"select",selected:t}}function Cc(e){return{item:e,type:"add"}}function Rc(e){return{id:e,type:"remove"}}function Vc(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 Ac=()=>{};function $e(e){const t=new Set;let o=Ac,i=()=>!1;const a=()=>t.size>0||i(),l=p=>{o=p},r=()=>{o=Ac},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 Tc(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 Fg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!$c(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 tl({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 Mc(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 Gg(e,t,o){const[i,a,l,r]=typeof e!="string"?Mc(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 Yg(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=Gg(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]=Mc(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 Wg({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function nl(e,t,o,i,a){const l=Wg(e.dimensions,Yg(e,o,i,a)),r=yc(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??jg(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 Bc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Kg({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=wi({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 qg(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 Dc={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
28
+ `).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function s1(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=c1(o.code,e);return Array.isArray(e)?e.some(a=>Bd(o[i],a,t,o.type==="keyup")):Bd(o[i],e,t,o.type==="keyup")}}function c1(e,t){return t.includes(e)?"code":"key"}function Fo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??r1),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const r=new Set;let l=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Fc(["blur","contextmenu"],s),Hc((...d)=>l(...d),d=>{var u,m;const f=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=l1(d),(!a||a&&!f)&&zr(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!p&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Hc((...d)=>l(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&zr(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=n.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?s1(d,r):d}return i}const Dd="vue-flow__node-desc",Od="vue-flow__edge-desc",d1="vue-flow__aria-live",Ld=["Enter"," ","Escape"],to={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Qi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function ea(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function ta(e){return{width:e.offsetWidth,height:e.offsetHeight}}function wn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Pd(e,t){return{x:wn(e.x,t[0][0],t[1][0]),y:wn(e.y,t[0][1],t[1][1])}}function zd(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function nn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function vn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!nn(e)}function Ho(e){return vn(e)&&"computedPosition"in e}function na(e){return!Number.isNaN(e)&&Number.isFinite(e)}function u1(e){return na(e.width)&&na(e.height)&&na(e.x)&&na(e.y)}function m1(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Ud(e,t,o){var i,a;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Fd(e,t,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return t.filter(s=>r.has(s.id))}function f1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.source===i).map(r=>o.find(l=>vn(l)&&l.id===r.target))}function p1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.target===i).map(r=>o.find(l=>vn(l)&&l.id===r.source))}function Hd({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function h1(e,t){return t.some(o=>nn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function Go({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function jo({x:e,y:t},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return r?ia(s,l):s}function Gd(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function oa({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function jd({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function y1(e,t){return jd(Gd(oa(e),oa(t)))}function Ur(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];t=Gd(t,oa({...i.computedPosition,...i.dimensions}))}return jd(t)}function Kd(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...jo(t,o),width:t.width/o.zoom,height:t.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,f=c.height??s.height??null;if(a&&!d||u)continue;const p=ea(r,Qi(s)),y=m===null||f===null,g=i&&p>0,_=(m??0)*(f??0);(y||g||p>=_||s.dragging)&&l.push(s)}return l}function xn(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function no(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return Wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function g1(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=no(e,o),a=no(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=no(e.top??e.y??0,o),a=no(e.bottom??e.y??0,o),r=no(e.left??e.x??0,t),l=no(e.right??e.x??0,t);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function b1(e,t,o,i,a,r){const{x:l,y:s}=Go(e,{x:t,y:o,zoom:i}),{x:c,y:d}=Go({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Yd(e,t,o,i,a,r=.1){const l=g1(r,t,o),s=(t-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=wn(d,i,a),m=e.x+e.width/2,f=e.y+e.height/2,p=t/2-m*u,y=o/2-f*u,g=b1(e,p,y,u,t,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:p-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function _1(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Wd(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Wd(o,t):!1}function Ko(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Fr(e){const t=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function qd(e,t,o){return e<t?wn(Math.abs(e-t),1,t)/t:e>o?-wn(Math.abs(e-o),1,t)/t:0}function Xd(e,t,o=15,i=40){const a=qd(e.x,i,t.width-i)*o,r=qd(e.y,i,t.height-i)*o;return[a,r]}function Hr(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...a}}:t.style={...t.style,...a}}}}function Jd(e,t){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")t.findIndex(c=>c.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(c=>c.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(Ho(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=t[r.indexOf(l.parentNode)];c&&Ho(c)&&Hr(l,c)}break;case"dimensions":if(Ho(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=t[r.indexOf(l.parentNode)];c&&Ho(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Hr(l,c):n.nextTick(()=>{Hr(l,c)}))}break}return t}function on(e,t){return{id:e,type:"select",selected:t}}function Zd(e){return{item:e,type:"add"}}function Qd(e){return{id:e,type:"remove"}}function eu(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function an(e,t=new Set,o=!1){const i=[];for(const[a,r]of e){const l=t.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(on(r.id,l)))}return i}const tu=()=>{};function Se(e){const t=new Set;let o=tu,i=()=>!1;const a=()=>t.size>0||i(),r=f=>{o=f},l=()=>{o=tu},s=f=>{i=f},c=()=>{i=()=>!1},d=f=>{t.delete(f)};return{on:f=>{t.add(f);const p=()=>d(f);return $o(p),{off:p}},off:d,trigger:f=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(y=>y(f)))},hasListeners:a,listeners:t,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function nu(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function k1(e,t,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Wd(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function Gr({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function ou(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function E1(e,t,o){const[i,a,r,l]=typeof e!="string"?ou(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function N1(e,t,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=E1(a,e,i);r&&(a=r)}else t(new it(et.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=ou(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function w1({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function jr(e,t,o,i,a){const r=w1(e.dimensions,N1(e,o,i,a)),l=Pd(t,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function oo(e,t,o=Re.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:l,height:s}=t??C1(e);if(i)return{x:a+l/2,y:r+s/2};switch((t==null?void 0:t.position)??o){case Re.Top:return{x:a+l/2,y:r};case Re.Right:return{x:a+l,y:r+s/2};case Re.Bottom:return{x:a+l/2,y:r+s};case Re.Left:return{x:a,y:r+s/2}}}function iu(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function v1({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=oa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),f=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*f)>0}function x1(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var et=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(et||{});const au={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
8
29
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
9
30
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
10
31
  Node: ${e}
@@ -24,18 +45,18 @@ Edge: ${e}
24
45
  Source: ${t}
25
46
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
26
47
  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 qe extends Error{constructor(t,...o){var i;super((i=Dc[t])==null?void 0:i.call(Dc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function ol(e){return"clientX"in e}function Xg(e){return"sourceEvent"in e}function kt(e,t){const o=ol(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 jg(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 vi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Zg=()=>!0;function il(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Jg(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())gi(a,yi(l))>0&&i.push(l);return i}const Qg=250;function eb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Jg(e,o,t+Qg);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 Oc(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Zg},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=Lc(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=Pc(F,K,q,m,o,!0)}return $}function Lc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function tb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function nb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Pc(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 al={[Ie.Left]:Ie.Right,[Ie.Right]:Ie.Left,[Ie.Top]:Ie.Bottom,[Ie.Bottom]:Ie.Top},ob=["production","prod"];function _o(e,...t){zc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function zc(){return!ob.includes(process.env.NODE_ENV||"")}function Uc(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,...bi(r)}}):null}function ll(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 ib(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:wc(e)},a=bc(a,void 0,i),Lg(a,t)?!1:a}function ab(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?wc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Hc(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=Bg(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 Fc(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 rl(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}`;Fc("source",c,u,e,a,r),Fc("target",c,d,e,l,s)}}function Gc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function sl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Ht(d)?d:ib(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({...bc(u,m,l),sourceNode:f,targetNode:p})}return c}const Yc=Symbol("vueFlow"),Wc=Symbol("nodeId"),Kc=Symbol("nodeRef"),lb=Symbol("edgeId"),rb=Symbol("edgeRef"),ki=Symbol("slots");function qc(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=db(),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}=nl(V,o.value?vi(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]=tl({id:de,dragItems:R,findNode:m});F({event:T,node:V,nodes:H})}},be=()=>{if(!P)return;const[Y,C]=Ic(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&&ll(k,h.value,N,_,b,!1,C);const V=re(Y.sourceEvent);if(W=V,R=Fg(l.value,f.value,V,de),R.length){const[H,te]=tl({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]=tl({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=Mh().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||!Tc(ne,`.${a.value}`,C)&&(!ge||Tc(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 sb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function cb(e,t){const o=sb();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 db(){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=Xg(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?vi(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function Ei(){return!0}function Xc({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=ol(E),T=gc(E.target),J=E.currentTarget;if(J&&(oe&&E.button===0||!oe)){let se=function(w){k=kt(w,ye),me=eb(yo(k,F.value,!1,[1,1]),u.value,Q.value,te),V||(H(),V=!0);const x=Oc(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=nb(!!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:al[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,tb(!!le,B)),Ee=j,!me&&!B&&!ee)return il(C);de&&de.source!==de.target&&ee&&(il(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)),il(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||Ei;!re&&we&&(re=(W?we.isValidSourcePos:we.isValidTargetPos)||Ei);let me,be=0;const{x:xe,y:Ce}=kt(E),Se=Lc(n.toValue(a),J),ye=(P=c.value)==null?void 0:P.getBoundingClientRect();if(!ye||!Se)return;const Y=Pc(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]=Ic(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:al[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||Ei;const J=g(n.toValue(t));if(!T&&J&&(T=(oe?J.isValidSourcePos:J.isValidTargetPos)||Ei),J&&(typeof J.connectable>"u"?m.value:J.connectable)===!1)return;const se=gc(E.target),he=Oc(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 ub(){return n.inject(Wc,"")}function jc(e){const t=e??ub()??"",o=n.inject(Kc,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 fb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function mb(e,t){const o=fb();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 Zc(){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}=nl(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 Ni=.1,pb=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 hb={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 yb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ao:li).scaleBy(cl(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}=yc({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:li).transform(cl(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:li).scaleTo(cl(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:Ni,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=Ja(s),{x:d,y:u,zoom:f}=Nc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ni);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:Ni})=>{const{x:r,y:s,zoom:c}=Nc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ni);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}}}:hb)}function cl(e,t=0,o=pb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function gb(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 bb(){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 _b(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=wb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function wb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Jc(){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:Xa.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:bb(),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 vb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function kb(e,t,o){const i=yb(e),a=k=>{const V=k??[];e.hooks.updateNodeInternals.trigger(V)},l=k=>Og(k,e.nodes,e.edges),r=k=>Dg(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=bi(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=Uc("source",ve.nodeElement,j,te,Ee.id),Ee.handleBounds.target=Uc("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=Hc(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=sl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);rl(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=Hc(V,d,e.hooks.error.trigger),te=[];for(const ne of H)te.push(Cc(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=sl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),te=[];for(const ne of H)te.push(Cc(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(Vc(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(Rc(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(Rc(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(Vc(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=ab(k,V,te,H,e.hooks.error.trigger);if(ge){const[ve]=sl([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),rl(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=>Sc(k,e.nodes),T=k=>{const V=Sc(k,e.edges);return rl(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=Mg(k),H=V?null:po(k)?k:d(k.id);return!V&&!H?[null,null,V]:[V?k:yi(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=yi(Ee),x=gi(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=gi(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];![...vb,...H].includes(ve)&&Ye(Ee)&&(e[ve]=Ee)}Sa(()=>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 Sa(()=>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=Jc();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 Eb=["data-id","data-handleid","data-nodeid","data-handlepos"],Nb={name:"Handle",compatConfig:{MODE:3}},un=n.defineComponent({...Nb,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}=jc(),_=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}=Xc({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,...bi(_.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],W]});function X(de){const B=ol(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,Eb))}}),$i=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})]};$i.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],$i.inheritAttrs=!1,$i.compatConfig={MODE:3};const $b=$i,xi=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])]};xi.props=["targetPosition","label","isValidTargetPos","connectable","data"],xi.inheritAttrs=!1,xi.compatConfig={MODE:3};const xb=xi,Ii=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})]};Ii.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ii.inheritAttrs=!1,Ii.compatConfig={MODE:3};const Ib=Ii,Sb=["transform"],Cb=["width","height","x","y","rx","ry"],Rb=["y"],Vb={name:"EdgeText",compatConfig:{MODE:3}},Ab=n.defineComponent({...Vb,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,Cb)):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,Rb)],8,Sb))}}),Tb=["id","d","marker-end","marker-start"],Mb=["d","stroke-width"],Bb={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Si=n.defineComponent({...Bb,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,Tb),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,Mb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(Ab,{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 Qc({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 ed({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 Ci(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function td({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Ie.Left:r=t-Ci(t-i,l),s=o;break;case Ie.Right:r=t+Ci(i-t,l),s=o;break;case Ie.Top:r=t,s=o-Ci(o-a,l);break;case Ie.Bottom:r=t,s=o+Ci(a-o,l);break}return[r,s]}function nd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,curvature:s=.25}=e,[c,d]=td({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=td({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[p,m,h,b]=ed({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 od({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 id(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top}=e,[s,c]=od({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=od({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,p,m,h]=ed({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 ad={[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 Db({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 ld(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ob({source:e,sourcePosition:t=Ie.Bottom,target:o,targetPosition:i=Ie.Top,center:a,offset:l}){const r=ad[t],s=ad[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=Db({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]=Qc({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 Lb(e,t,o,i){const a=Math.min(ld(e,t)/2,ld(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 dl(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]=Ob({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?$=Lb(f[y-1],N,f[y+1],s):$=`${y===0?"M":"L"}${N.x} ${N.y}`,_+=$,_},""),p,m,h,b]}function Pb(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Qc({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const zb=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]=Pb(e);return n.h(Si,{path:o,labelX:i,labelY:a,...t,...e})}}}),rd=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]=dl({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Si,{path:o,labelX:i,labelY:a,...t,...e})}}}),Ub=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(rd,{...e,...t,borderRadius:0})}}),Hb=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]=nd({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Si,{path:o,labelX:i,labelY:a,...t,...e})}}}),Fb=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]=id({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Si,{path:o,labelX:i,labelY:a,...t,...e})}}}),Gb={input:Ib,default:$b,output:xb},Yb={default:Hb,straight:zb,step:Ub,smoothstep:rd,simplebezier:Fb};function Wb(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={...Yb,...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={...Gb,...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?Ec(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);Kg({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=Jc(),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=Wb(a,s,c),u=kb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Fm(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(Yc,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(Yc,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 Kb(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=bi(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 qb={name:"UserSelection",compatConfig:{MODE:3}},Xb=n.defineComponent({...qb,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))}}),jb=["tabIndex"],Zb={name:"NodesSelection",compatConfig:{MODE:3}},Jb=n.defineComponent({...Zb,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=De(),s=Zc(),c=n.ref(null),d=qc({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(()=>Ja(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,jb)],6)):n.createCommentVNode("",!0)}});function Qb(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const e0={name:"Pane",compatConfig:{MODE:3}},t0=n.defineComponent({...e0,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}=Qb(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(Ec(o.value,ye,i.value,h.value===Xa.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(!Gc(Y,X.value)){const V=Gt(y.value,X.value,!0);a.nodesChange(V)}if(!Gc(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(Xb,{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(Jb,{key:1})):n.createCommentVNode("",!0)],34))}}),n0={name:"Transform",compatConfig:{MODE:3}},o0=n.defineComponent({...n0,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))}}),i0={name:"Viewport",compatConfig:{MODE:3}},a0=n.defineComponent({...i0,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();Kb(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=Ig().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(Qa),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=Qa(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(t0,{"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(o0,null,{default:n.withCtx(()=>[n.renderSlot(Se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),l0=["id"],r0=["id"],s0=["id"],c0={name:"A11yDescriptions",compatConfig:{MODE:3}},d0=n.defineComponent({...c0,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(mc)}-${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,l0),n.createElementVNode("div",{id:`${n.unref(pc)}-${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,r0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(Tg)}-${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,s0))],64))}});function u0(){const e=De();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function f0(e,t,o){return o===Ie.Left?e-t:o===Ie.Right?e+t:e}function m0(e,t,o){return o===Ie.Top?e-t:o===Ie.Bottom?e+t:e}const ul=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:f0(t,e,i),cy:m0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ul.props=["radius","centerX","centerY","position","type"],ul.compatConfig={MODE:3};const sd=ul,p0=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}=cb(y.value,l),F=n.inject(ki),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(lb,e.id),n.provide(rb,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}=Xc({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=Bc(ne,y.value.sourceHandle);let ve;i.value===At.Strict?ve=H.handleBounds.target:ve=[...H.handleBounds.target||[],...H.handleBounds.source||[]];const Ee=Bc(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?`${pc}-${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(sd,{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(sd,{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&&hc.includes(V.key)&&v.value&&(V.key==="Escape"?((H=ee.value)==null||H.blur(),d([u(e.id)])):o([u(e.id)]))}}}),h0=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(ki))==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?al[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]=nd(P):R===rn.Step?[E]=dl({...P,borderRadius:0}):R===rn.SmoothStep?[E]=dl(P):R===rn.SimpleBezier?[E]=id(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})))}}}),y0=["id","markerWidth","markerHeight","markerUnits","orient"],g0={name:"MarkerType",compatConfig:{MODE:3}},b0=n.defineComponent({...g0,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(ja).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(ja).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,y0))}}),_0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},w0={name:"MarkerDefinitions",compatConfig:{MODE:3}},v0=n.defineComponent({...w0,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",_0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(b0,{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))])]))}}),k0={name:"Edges",compatConfig:{MODE:3}},E0=n.defineComponent({...k0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=De();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(v0),(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(qg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(p0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(h0))],64))}}),N0=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(Kc,G),n.provide(Wc,e.id);const X=n.inject(ki),Q=n.getCurrentInstance(),de=Zc(),{node:B,parentNode:ee}=jc(e.id),{emit:v,on:R}=mb(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=qc({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=Hg({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"?Sa(()=>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:`${mc}-${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}=nl(B,g.value?vi(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)&&ll(B,l.value,c,s,a,!1,G.value),v.click({event:H,node:B})}function V(H){if(!(Za(H)||h.value))if(hc.includes(H.key)&&P.value){const te=H.key==="Escape";ll(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 $0(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 x0={class:"vue-flow__nodes vue-flow__container"},I0={name:"Nodes",compatConfig:{MODE:3}},S0=n.defineComponent({...I0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=De(),a=$0(),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",x0,[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(N0),{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 C0(){const{emits:e}=De();n.onMounted(()=>{if(zc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new qe(Ge.MISSING_STYLES))}})}const R0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),V0={name:"VueFlow",compatConfig:{MODE:3}},A0=n.defineComponent({...V0,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=Ca(i,"modelValue",o),r=Ca(i,"nodes",o),s=Ca(i,"edges",o),c=De(i),d=gb({modelValue:l,nodes:r,edges:s},i,c);return _b(o,c.hooks),u0(),C0(),n.provide(ki,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(a0,null,{default:n.withCtx(()=>[n.createVNode(E0),R0,n.createVNode(S0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(d0)],512))}}),T0={name:"Panel",compatConfig:{MODE:3}},cd=n.defineComponent({...T0,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"],dd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function M0(e){return typeof e=="string"&&e in dd}const B0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},D0=.15;function O0(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 L0(e){if(typeof e!="string")return null;const t=O0(e);if(!t||t.s<D0)return null;let o=null,i=1/0;for(const a of mn){const l=Math.abs(t.h-B0[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(M0(t))return t;const o=e==null?void 0:e.properties;return L0((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 P0={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)"},z0={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 ud(e,t=!1){return e?t?z0[e]:P0[e]:null}function Bn(e){return dd[e]}function Dn(e){return`var(--em-swatch-${e}-bar)`}const U0=["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"/>',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,U0))}}),Le=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Le(H0,[["__scopeId","data-v-5256c2f6"]]),F0={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",F0,[(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"]]),G0={class:"em-mlang"},Y0={class:"em-mlang__tabs",role:"tablist"},W0=["aria-selected","onClick"],K0={key:0,class:"em-mlang__dot"},ml=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",G0,[n.createElementVNode("div",Y0,[(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",K0,"•")):n.createCommentVNode("",!0)],10,W0))),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"]]),q0=["disabled"],X0={class:"em-panel__sub-label"},j0={class:"em-field"},Z0={class:"em-field"},J0={class:"em-field"},Q0={class:"em-class"},e1={class:"em-field"},t1={class:"em-field"},n1={class:"em-field"},o1={class:"em-field"},i1={class:"em-multilang"},a1={class:"em-multilang"},l1={class:"em-jpa"},r1={class:"em-field"},s1={class:"em-field"},c1={class:"em-field"},d1={class:"em-swatch"},u1={class:"em-swatch__row"},f1=["title","onClick"],fd=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",X0,[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",j0,[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",Z0,[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",J0,[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",Q0,[ee[18]||(ee[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",e1,[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",t1,[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",n1,[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",o1,[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",i1,[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",a1,[ee[22]||(ee[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ml,{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",l1,[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",r1,[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",s1,[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",c1,[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",d1,[ee[27]||(ee[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",u1,[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,f1))),128))])])],64)):n.createCommentVNode("",!0)],8,q0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),md=["ko","en","ja","zh"];function m1(e){if(e)for(const t of md){const o=e[t];if(o)return o}}function pl(e){const t=m1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function p1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:md.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const h1=["aria-expanded"],y1=["aria-selected","onClick","onMouseenter"],g1={key:0,class:"gcc__opt gcc__opt--empty"},pd=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?pl(f.value):"");n.watch(p,G=>{c.value||(s.value=G)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:p1(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=pl(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,h1),[[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(pl)(Q)),43,y1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",g1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),b1=["disabled"],_1={class:"em-aw__toolbar"},w1={class:"em-aw__count"},v1={class:"em-aw__scroll"},k1={class:"em-aw__table"},E1={key:0,class:"c-code"},N1=["colspan"],$1={class:"c-del"},x1={class:"c-flag"},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={key:0},B1={class:"c-del"},D1=["colspan"],O1={class:"c-del"},L1={class:"em-aw__embed-label"},P1={class:"em-aw__ro"},z1={class:"em-aw__ro"},U1={class:"em-aw__ro"},H1={class:"em-aw__ro"},F1={colspan:"8"},G1=["colspan"],Y1={key:0},Ri="__OWN__",W1=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[Ri,...ve.value.map(O=>O.modelId)]}function w(O){if(O===Ri)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)??Ri}function j(O,U,M){he(O,U,{sharedColumnRef:M===Ri?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",_1,[n.createElementVNode("span",w1,"속성 ("+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",v1,[n.createElementVNode("table",k1,[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",E1,"코드그룹")):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,N1),n.createElementVNode("td",$1,[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,D1),n.createElementVNode("td",O1,[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",L1,"↳ "+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",P1,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",z1,n.toDisplayString(me(M,Ae)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",U1,n.toDisplayString(be(M,Ae)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",H1,n.toDisplayString(xe(M,Ae)??""),1)]),n.createElementVNode("td",F1,[(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,G1)])}),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(Ql)(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(Zl)(((L=M.dbAttrs[0])==null?void 0:L.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(sa),"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",x1,[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",I1,[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",S1,[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",C1,[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",R1,[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",V1,[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",A1,[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",T1,[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",M1,[n.createVNode(pd,{"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",B1,[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",Y1,[...U[22]||(U[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,b1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-d8326b9d"]]),K1=["disabled"],q1={class:"em-idxw__list"},X1={class:"em-idxw__list-head"},j1=["onClick"],Z1={class:"em-idxw__item-name"},J1={key:0,class:"em-idxw__badge"},Q1={class:"em-idxw__item-cnt"},e_={key:0,class:"em-idxw__empty"},t_={key:0,class:"em-idxw__edit"},n_={class:"em-idxw__form"},o_={class:"em-field em-idxw__name"},i_={class:"em-field"},a_=["value"],l_={class:"em-idxw__transfer"},r_={class:"em-idxw__pane"},s_={class:"em-idxw__pane-head"},c_={class:"em-idxw__cols"},d_=["onClick"],u_={key:0,class:"em-idxw__empty"},f_={class:"em-idxw__arrows"},m_={class:"em-idxw__pane"},p_={class:"em-idxw__pane-head"},h_={class:"em-idxw__cols"},y_={class:"em-idxw__col-name"},g_={class:"em-idxw__col-ops"},b_=["disabled","onClick"],__=["disabled","onClick"],w_=["onClick"],v_={key:0,class:"em-idxw__empty"},k_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},E_=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",q1,[n.createElementVNode("div",X1,[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",Z1,n.toDisplayString(G.name||"(이름 없음)"),1),G.unique?(n.openBlock(),n.createElementBlock("span",J1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",Q1,n.toDisplayString(G.columns.length),1)],10,j1))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",e_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",t_,[n.createElementVNode("div",n_,[n.createElementVNode("label",o_,[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",i_,[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,a_)]),n.createElementVNode("div",l_,[n.createElementVNode("div",r_,[n.createElementVNode("div",s_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",c_,[(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,d_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",u_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",f_,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:N},null,8,["disabled"])]),n.createElementVNode("div",m_,[n.createElementVNode("div",p_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",h_,[(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",y_,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",g_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:X===0,onClick:Q=>K(X,-1)},"↑",8,b_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:X===s.value.columns.length-1,onClick:Q=>K(X,1)},"↓",8,__),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:Q=>y(X)},"✕",8,w_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",v_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",k_,"인덱스를 선택하거나 추가하세요."))],8,K1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),N_={class:"em-op-src"},$_={class:"em-op-src__actions"},hd=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_,[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",$_,[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"]]),x_=["disabled"],I_={class:"em-ow__toolbar"},S_={class:"em-ow__count"},C_={class:"em-ow__scroll"},R_={class:"em-ow__table"},V_={class:"c-del"},A_={key:0},T_=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:hd,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",I_,[n.createElementVNode("span",S_,"오퍼레이션 ("+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",C_,[n.createElementVNode("table",R_,[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",V_,[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",A_,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,x_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),M_={class:"em-detail__tabs"},B_=["onClick"],D_=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",M_,[(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,B_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(fd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(W1,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(E_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(T_,{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 Vi(e,t,o){e.openModal({component:D_,bind:{controller:n.markRaw(t),entityId:o}})}function O_(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 yd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ai(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 zf(e,t,Te))o.push(...Ai(i,a));return o}function gd(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 hl(e,t){const o=Jn(e,t,Te),i=Ai(t,o),a=gd(e,t,o);return i.push(...Ln(a,t)),i}function bd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Te()}))}function L_(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(...Ai(t,s));const c=gd(r,t,s);return i.push(...Ln(c,t)),i}function P_(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 z_(e=yd(),t={}){var ve,Ee;const o=n.reactive(e);let i=new ya(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 Wr({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(()=>Ul(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(()=>nr(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=[yr(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(Rr(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(ka(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(ba(w.id))}else if(w.kind==="note")C($a(w.id));else if(w.kind==="group"){if(V(w.id))return!1;C(va(w.id))}else C(Na(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 ya(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(ga(le,{location:{...x},size:{width:220,height:140}})),j},renameEntity(w,x){k(w)||C(cr(w,x))},updateEntity(w,x){if(k(w))return;const j=sr(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=hl(M,w),S=P_(o.logical,w),D=[j,...U,...pe,...S];C(D.length>1?ze("임베더블 변환",D):j);return}if(O){const U=L_(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(dr(w,x))},removeEntity(w){k(w)||C(ba(w))},setEntitySwatch(w,x){C(ur(w,x))},setEntityCollapsed(w,x){C(fr(w,x))},setEntityLocked(w,x){C(mr(w,x))},isEntityLocked(w){return k(w)},collapseAll(){C(_a(!0))},expandAll(){C(_a(!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(gr(w,x))},setGroupSwatch(w,x){C(br(w,x))},setGroupLocked(w,x){C(_r(w,x))},isGroupLocked(w){return V(w)},updateGroup(w,x){V(w)||C(pr(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(wa(_e,ne(w))),C(ze("그룹 생성",j)),R.value=null,le},addEmptyGroup(w,x){const j=Te();return C(wa({modelId:j,name:x?{ko:x}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),j},removeGroup(w){V(w)||C(va(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(hr(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(Lr(le,w)),j&&_e.push(Or(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??ca,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:ca})},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(ka(w,x,j))},addIndex(w,x){k(w)||C($r(w,x))},updateIndex(w,x,j){k(w)||C(xr(w,x,j))},removeIndex(w,x){k(w)||C(Ir(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(wr(w,O)),_e},updateOperation(w,x,j){k(w)||C(vr(w,x,j))},removeOperation(w,x){k(w)||C(kr(w,x))},reorderOperations(w,x,j){!x.length||k(w)||C(Er(w,x,j))},setOperationSwatch(w,x,j){C(Nr(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=Ea(O,S),I=Ai(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=bd(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),Ea(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:bd(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=Na(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=hl(_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=hl(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(Sr(w,x,j))},addWaypoint(w,x,j){C(Ar(w,x,j))},removeWaypoint(w,x){C(Cr(w,x))},clearWaypoints(w){C(Vr(w))},addNote(w="메모",x={x:80,y:80}){const j=Te();return C(Tr({modelId:j,memo:w,geo:{location:{...x},size:{width:200,height:120}}})),j},removeNote(w){C($a(w))},moveNote(w,x){C(Zn(w,x))},resizeNote(w,x){C(Mr(w,x))},setNoteMemo(w,x){C(Br(w,x))},setNoteSwatch(w,x){C(Dr(w,x))},addNoteConnection(w,x){C(Pr(w,x))},removeNoteConnection(w,x){C(zr(w,x))},moveNoteConnectionWaypoint(w,x,j,le){C(Ur(w,x,j,le))},addNoteConnectionWaypoint(w,x,j,le){C(Hr(w,x,j,le))},removeNoteConnectionWaypoint(w,x,j){C(Fr(w,x,j))},clearNoteConnectionWaypoints(w,x){C(Gr(w,x))},autoLayout(){const w=Gl(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=O_(w.entity),j={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};C(ga(x,j)),R.value={kind:"entity",id:x.modelId}}}}const Ti=Symbol("groupHover"),_d=Symbol("groupDrag"),Pn=Symbol("relationHighlight"),U_={key:0,class:"em-sel","aria-hidden":"true"},H_=["title","aria-expanded","disabled"],F_={class:"em-entity__stereotype"},G_={key:1,class:"em-entity__name"},Y_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],W_=["onPointerdown"],K_={key:1,class:"em-entity__divider-label"},q_=["title"],X_={class:"em-key-slot"},j_={class:"em-key-slot"},Z_={key:0,class:"em-entity__type"},J_=["onClick"],Q_={class:"em-entity__attrname"},ew={class:"em-entity__type"},tw=["data-op"],nw=["onPointerdown"],ow={class:"em-entity__op-vis","aria-hidden":"true"},iw=["title"],aw={key:4,class:"em-entity__footer"},wd=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&&Vi(i,o,t.id)}const l=n.inject(Ti,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=fl(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=fl(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=fl(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=er(I,(o==null?void 0:o.state.logical.associations)??[]);return ua($.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",U_,[...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,H_),n.createElementVNode("span",F_,"«"+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",G_,[(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,W_)):n.createCommentVNode("",!0),J(ie)?(n.openBlock(),n.createElementBlock("span",K_,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",X_,[(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",j_,[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,q_),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",Z_,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,Y_),(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",Q_,[(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",ew,n.toDisplayString(z.dataType),1)],10,J_))),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,nw)):n.createCommentVNode("",!0),n.createElementVNode("span",ow,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,tw)}),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,iw)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",aw,[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"]]),lw={key:0,class:"em-sel","aria-hidden":"true"},rw={class:"em-group__label"},sw={class:"em-group__name"},cw={key:0,class:"em-group__pkg"},dw={key:1,class:"em-group__flag"},vd=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(Ti,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",lw,[...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",rw,[n.createElementVNode("span",sw,n.toDisplayString(G.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",cw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",dw,"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"]]),uw={key:0,class:"em-sel","aria-hidden":"true"},fw={key:2,class:"em-note__text"},kd=Le(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(hn,null),i=n.inject(Ti,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",uw,[...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",fw,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"]]),mw=20,pw=22,hw=7,yw=22,Ed=31,Nd=7,gw=20,$d=11,xd=11,bw=Ed+Nd;function _w(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function ww(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Mi(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 Id(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Bi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Sd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Id(e,t);return[Bi(o,a,l-Math.PI/2),Bi(o,a,l+Math.PI/2)]}function Cd(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 Rd(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=Mi(e,t,mw),[d,u]=Sd(e,t,c,pw);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}),_w(o.multiplicity)){const f=Mi(e,t,Ed);l.push({cx:f.x,cy:f.y,r:Nd})}if(ww(o.multiplicity)){const f=Mi(e,t,hw),[p,m]=Sd(e,t,f,yw);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=Mi(e,t,gw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Id(e,t),f=Bi(d,$d/2,u-Math.PI/2),p=Bi(d,$d/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=Cd(s,c,xd,!0),u=Cd(s,c,xd,!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 Vd=200,Ad=120,yl=24;function Td(e){var a,l;if(!e)return{x:0,y:0,width:Vd,height:Ad};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Vd,i=((l=e.dimensions)==null?void 0:l.height)||Ad;return{x:t.x,y:t.y,width:o,height:i}}function Md(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bd(e){const t=n.computed(()=>Td(e.sourceNode())),o=n.computed(()=>Td(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)<yl){const b=(f+p)/2;f=b-yl/2,p=b+yl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),l=n.computed(()=>e.waypoints()[0]??Md(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Md(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?aa(t.value,d,l.value.x):ia(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?aa(o.value,d,r.value.x):ia(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 gl=Symbol("waypointController"),vw=["d"],kw=["d"],Ew=["d"],Nw=["x1","y1","x2","y2"],$w=["cx","cy","r"],xw=["x","y"],Iw=["x","y"],Sw=["cx","cy","onDblclick"],Cw=["x","y","onPointerdown","onDblclick"],Dd=Le(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=De(),i=n.inject(gl),a=n.inject(hn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(_d,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}=Bd({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=bw+4,G=n.computed(()=>F.value?Fl(N.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(N.value,$.value,b.value,y.value,K.value,q):oa(N.value,b.value,y.value)),X=n.computed(()=>F.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?na(N.value,$.value,b.value,y.value,K.value,q):la(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(()=>Rd(N.value,J.value,he.value,oe.value)),me=n.computed(()=>Rd(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,vw),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,kw),(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,Ew))),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,Nw))),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,$w))),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,xw),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,Iw)],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,Sw))),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,Cw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Tt=(e=>(e.Lines="lines",e.Dots="dots",e))(Tt||{});const Od=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]}`})},Ld=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Tt.Lines+"",Tt.Dots+"";const Rw={[Tt.Dots]:"#81818a",[Tt.Lines]:"#eee"},Vw=["id","x","y","width","height","patternTransform"],Aw={key:2,height:"100",width:"100"},Tw=["fill"],Mw=["x","y","fill"],Bw={name:"Background",compatConfig:{MODE:3}},Dw=n.defineComponent({...Bw,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||Rw[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(Od),{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(Ld),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Aw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Tw)])):n.createCommentVNode("",!0)])],8,Vw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Mw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Ow={name:"ControlButton",compatConfig:{MODE:3}},Lw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Pw={type:"button",class:"vue-flow__controls-button"};function zw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Pw,[n.renderSlot(e.$slots,"default")])}const yn=Lw(Ow,[["render",zw]]),Uw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Hw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Fw(e,t){return n.openBlock(),n.createElementBlock("svg",Uw,Hw)}const Gw={render:Fw},Yw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Ww=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Kw(e,t){return n.openBlock(),n.createElementBlock("svg",Yw,Ww)}const qw={render:Kw},Xw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},jw=[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 Zw(e,t){return n.openBlock(),n.createElementBlock("svg",Xw,jw)}const Jw={render:Zw},Qw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ev=[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 tv(e,t){return n.openBlock(),n.createElementBlock("svg",Qw,ev)}const nv={render:tv},ov={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},iv=[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 av(e,t){return n.openBlock(),n.createElementBlock("svg",ov,iv)}const lv={render:av},rv={name:"Controls",compatConfig:{MODE:3}},sv=n.defineComponent({...rv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>uc.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(cd),{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(Gw))))])]),_: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(qw))))])]),_: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(Jw))))])]),_: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(lv))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(nv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var cv={value:()=>{}};function bl(){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 Di(o)}function Di(e){this._=e}function dv(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}})}Di.prototype=bl.prototype={constructor:Di,on:function(e,t){var o=this._,i=dv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=uv(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]=Pd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Pd(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 Di(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 uv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Pd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=cv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var _l="http://www.w3.org/1999/xhtml";const zd={svg:"http://www.w3.org/2000/svg",xhtml:_l,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Oi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),zd.hasOwnProperty(t)?{space:zd[t],local:e}:e}function fv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===_l&&t.documentElement.namespaceURI===_l?t.createElement(e):t.createElementNS(o,e)}}function mv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ud(e){var t=Oi(e);return(t.local?mv:fv)(t)}function pv(){}function wl(e){return e==null?pv:function(){return this.querySelector(e)}}function hv(e){typeof e!="function"&&(e=wl(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 yv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gv(){return[]}function Hd(e){return e==null?gv:function(){return this.querySelectorAll(e)}}function bv(e){return function(){return yv(e.apply(this,arguments))}}function _v(e){typeof e=="function"?e=bv(e):e=Hd(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 Fd(e){return function(){return this.matches(e)}}function Gd(e){return function(t){return t.matches(e)}}var wv=Array.prototype.find;function vv(e){return function(){return wv.call(this.children,e)}}function kv(){return this.firstElementChild}function Ev(e){return this.select(e==null?kv:vv(typeof e=="function"?e:Gd(e)))}var Nv=Array.prototype.filter;function $v(){return Array.from(this.children)}function xv(e){return function(){return Nv.call(this.children,e)}}function Iv(e){return this.selectAll(e==null?$v:xv(typeof e=="function"?e:Gd(e)))}function Sv(e){typeof e!="function"&&(e=Fd(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 Yd(e){return new Array(e.length)}function Cv(){return new rt(this._enter||this._groups.map(Yd),this._parents)}function Li(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Li.prototype={constructor:Li,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 Rv(e){return function(){return e}}function Vv(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 Li(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Av(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 Li(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Tv(e){return e.__data__}function Mv(e,t){if(!arguments.length)return Array.from(this,Tv);var o=t?Av:Vv,i=this._parents,a=this._groups;typeof e!="function"&&(e=Rv(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=Bv(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 Bv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Dv(){return new rt(this._exit||this._groups.map(Yd),this._parents)}function Ov(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 Lv(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 Pv(){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 zv(e){e||(e=Uv);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 Uv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Hv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Fv(){return Array.from(this)}function Gv(){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 Yv(){let e=0;for(const t of this)++e;return e}function Wv(){return!this.node()}function Kv(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 qv(e){return function(){this.removeAttribute(e)}}function Xv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jv(e,t){return function(){this.setAttribute(e,t)}}function Zv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Qv(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 ek(e,t){var o=Oi(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?Xv:qv:typeof t=="function"?o.local?Qv:Jv:o.local?Zv:jv)(o,t))}function Wd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function tk(e){return function(){this.style.removeProperty(e)}}function nk(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ok(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function ik(e,t,o){return arguments.length>1?this.each((t==null?tk:typeof t=="function"?ok:nk)(e,t,o??"")):zn(this.node(),e)}function zn(e,t){return e.style.getPropertyValue(t)||Wd(e).getComputedStyle(e,null).getPropertyValue(t)}function ak(e){return function(){delete this[e]}}function lk(e,t){return function(){this[e]=t}}function rk(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function sk(e,t){return arguments.length>1?this.each((t==null?ak:typeof t=="function"?rk:lk)(e,t)):this.node()[e]}function Kd(e){return e.trim().split(/^|\s+/)}function vl(e){return e.classList||new qd(e)}function qd(e){this._node=e,this._names=Kd(e.getAttribute("class")||"")}qd.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 Xd(e,t){for(var o=vl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function jd(e,t){for(var o=vl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function ck(e){return function(){Xd(this,e)}}function dk(e){return function(){jd(this,e)}}function uk(e,t){return function(){(t.apply(this,arguments)?Xd:jd)(this,e)}}function fk(e,t){var o=Kd(e+"");if(arguments.length<2){for(var i=vl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?uk:t?ck:dk)(o,t))}function mk(){this.textContent=""}function pk(e){return function(){this.textContent=e}}function hk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yk(e){return arguments.length?this.each(e==null?mk:(typeof e=="function"?hk:pk)(e)):this.node().textContent}function gk(){this.innerHTML=""}function bk(e){return function(){this.innerHTML=e}}function _k(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function wk(e){return arguments.length?this.each(e==null?gk:(typeof e=="function"?_k:bk)(e)):this.node().innerHTML}function vk(){this.nextSibling&&this.parentNode.appendChild(this)}function kk(){return this.each(vk)}function Ek(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Nk(){return this.each(Ek)}function $k(e){var t=typeof e=="function"?e:Ud(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function xk(){return null}function Ik(e,t){var o=typeof e=="function"?e:Ud(e),i=t==null?xk:typeof t=="function"?t:wl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Sk(){var e=this.parentNode;e&&e.removeChild(this)}function Ck(){return this.each(Sk)}function Rk(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vk(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ak(e){return this.select(e?Vk:Rk)}function Tk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Mk(e){return function(t){e.call(this,t,this.__data__)}}function Bk(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 Dk(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 Ok(e,t,o){return function(){var i=this.__on,a,l=Mk(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 Lk(e,t,o){var i=Bk(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?Ok:Dk,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Zd(e,t,o){var i=Wd(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 Pk(e,t){return function(){return Zd(this,e,t)}}function zk(e,t){return function(){return Zd(this,e,t.apply(this,arguments))}}function Uk(e,t){return this.each((typeof t=="function"?zk:Pk)(e,t))}function*Hk(){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 Jd=[null];function rt(e,t){this._groups=e,this._parents=t}function wo(){return new rt([[document.documentElement]],Jd)}function Fk(){return this}rt.prototype=wo.prototype={constructor:rt,select:hv,selectAll:_v,selectChild:Ev,selectChildren:Iv,filter:Sv,data:Mv,enter:Cv,exit:Dv,join:Ov,merge:Lv,selection:Fk,order:Pv,sort:zv,call:Hv,nodes:Fv,node:Gv,size:Yv,empty:Wv,each:Kv,attr:ek,style:ik,property:sk,classed:fk,text:yk,html:wk,raise:kk,lower:Nk,append:$k,insert:Ik,remove:Ck,clone:Ak,datum:Tk,on:Lk,dispatch:Uk,[Symbol.iterator]:Hk};function Wt(e){return typeof e=="string"?new rt([[document.querySelector(e)]],[document.documentElement]):new rt([[e]],Jd)}function Gk(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kt(e,t){if(e=Gk(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 kl={capture:!0,passive:!1};function El(e){e.preventDefault(),e.stopImmediatePropagation()}function Yk(e){var t=e.document.documentElement,o=Wt(e).on("dragstart.drag",El,kl);"onselectstart"in t?o.on("selectstart.drag",El,kl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Wk(e,t){var o=e.document.documentElement,i=Wt(e).on("dragstart.drag",null);t&&(i.on("click.drag",El,kl),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 Nl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Qd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function vo(){}var ko=.7,Pi=1/ko,Un="\\s*([+-]?\\d+)\\s*",Eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kk=/^#([0-9a-f]{3,8})$/,qk=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),Xk=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),jk=new RegExp(`^rgba\\(${Un},${Un},${Un},${Eo}\\)$`),Zk=new RegExp(`^rgba\\(${Et},${Et},${Et},${Eo}\\)$`),Jk=new RegExp(`^hsl\\(${Eo},${Et},${Et}\\)$`),Qk=new RegExp(`^hsla\\(${Eo},${Et},${Et},${Eo}\\)$`),eu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Nl(vo,No,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tu,formatHex:tu,formatHex8:eE,formatHsl:tE,formatRgb:nu,toString:nu});function tu(){return this.rgb().formatHex()}function eE(){return this.rgb().formatHex8()}function tE(){return ru(this).formatHsl()}function nu(){return this.rgb().formatRgb()}function No(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Kk.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ou(t):o===3?new it(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?zi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?zi(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=qk.exec(e))?new it(t[1],t[2],t[3],1):(t=Xk.exec(e))?new it(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jk.exec(e))?zi(t[1],t[2],t[3],t[4]):(t=Zk.exec(e))?zi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Jk.exec(e))?lu(t[1],t[2]/100,t[3]/100,1):(t=Qk.exec(e))?lu(t[1],t[2]/100,t[3]/100,t[4]):eu.hasOwnProperty(e)?ou(eu[e]):e==="transparent"?new it(NaN,NaN,NaN,0):null}function ou(e){return new it(e>>16&255,e>>8&255,e&255,1)}function zi(e,t,o,i){return i<=0&&(e=t=o=NaN),new it(e,t,o,i)}function nE(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 $l(e,t,o,i){return arguments.length===1?nE(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}Nl(it,$l,Qd(vo,{brighter(e){return e=e==null?Pi:Math.pow(Pi,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),Ui(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:iu,formatHex:iu,formatHex8:oE,formatRgb:au,toString:au}));function iu(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}`}function oE(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}${bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function au(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${e===1?")":`, ${e})`}`}function Ui(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 lu(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 ru(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 iE(e,t,o,i){return arguments.length===1?ru(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}Nl(pt,iE,Qd(vo,{brighter(e){return e=e==null?Pi:Math.pow(Pi,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(xl(e>=240?e-240:e+120,a,i),xl(e,a,i),xl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new pt(su(this.h),Hi(this.s),Hi(this.l),Ui(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=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${su(this.h)}, ${Hi(this.s)*100}%, ${Hi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function su(e){return e=(e||0)%360,e<0?e+360:e}function Hi(e){return Math.max(0,Math.min(1,e||0))}function xl(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 cu=e=>()=>e;function aE(e,t){return function(o){return e+o*t}}function lE(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 rE(e){return(e=+e)==1?du:function(t,o){return o-t?lE(t,o,e):cu(isNaN(t)?o:t)}}function du(e,t){var o=t-e;return o?aE(e,o):cu(isNaN(e)?t:e)}const uu=(function e(t){var o=rE(t);function i(a,l){var r=o((a=$l(a)).r,(l=$l(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=du(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 Il=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sl=new RegExp(Il.source,"g");function sE(e){return function(){return e}}function cE(e){return function(t){return e(t)+""}}function dE(e,t){var o=Il.lastIndex=Sl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Il.exec(e))&&(a=Sl.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=Sl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?cE(c[0].x):sE(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 fu=180/Math.PI,Cl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mu(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)*fu,skewX:Math.atan(c)*fu,scaleX:r,scaleY:s}}var Fi;function uE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Cl:mu(t.a,t.b,t.c,t.d,t.e,t.f)}function fE(e){return e==null||(Fi||(Fi=document.createElementNS("http://www.w3.org/2000/svg","g")),Fi.setAttribute("transform",e),!(e=Fi.transform.baseVal.consolidate()))?Cl:(e=e.matrix,mu(e.a,e.b,e.c,e.d,e.e,e.f))}function pu(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 mE=pu(uE,"px, ","px)","deg)"),pE=pu(fE,", ",")",")"),hE=1e-12;function hu(e){return((e=Math.exp(e))+1/e)/2}function yE(e){return((e=Math.exp(e))-1/e)/2}function gE(e){return((e=Math.exp(2*e))-1)/(e+1)}const bE=(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<hE)_=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=hu(K),Q=d/(o*N)*(X*gE(t*G+K)-yE(K));return[s+Q*m,c+Q*h,d*X/hu(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,yu=1e3,Gi,Io,Yi=0,_n=0,Wi=0,So=typeof performance=="object"&&performance.now?performance:Date,gu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rl(){return _n||(gu(_E),_n=So.now()+Wi)}function _E(){_n=0}function Ki(){this._call=this._time=this._next=null}Ki.prototype=bu.prototype={constructor:Ki,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Rl():+o)+(t==null?0:+t),!this._next&&Io!==this&&(Io?Io._next=this:Gi=this,Io=this),this._call=e,this._time=o,Vl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vl())}};function bu(e,t,o){var i=new Ki;return i.restart(e,t,o),i}function wE(){Rl(),++Hn;for(var e=Gi,t;e;)(t=_n-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hn}function _u(){_n=(Yi=So.now())+Wi,Hn=$o=0;try{wE()}finally{Hn=0,kE(),_n=0}}function vE(){var e=So.now(),t=e-Yi;t>yu&&(Wi-=t,Yi=e)}function kE(){for(var e,t=Gi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Gi=o);Io=e,Vl(i)}function Vl(e){if(!Hn){$o&&($o=clearTimeout($o));var t=e-_n;t>24?(e<1/0&&($o=setTimeout(_u,e-So.now()-Wi)),xo&&(xo=clearInterval(xo))):(xo||(Yi=So.now(),xo=setInterval(vE,yu)),Hn=1,gu(_u))}}function wu(e,t,o){var i=new Ki;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var EE=bl("start","end","cancel","interrupt"),NE=[],vu=0,ku=1,Al=2,qi=3,Eu=4,Tl=5,Xi=6;function ji(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;$E(e,o,{name:t,index:i,group:a,on:EE,tween:NE,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:vu})}function Ml(e,t){var o=ht(e,t);if(o.state>vu)throw new Error("too late; already scheduled");return o}function Nt(e,t){var o=ht(e,t);if(o.state>qi)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 $E(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=bu(l,0,o.time);function l(d){o.state=ku,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!==ku)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===qi)return wu(r);m.state===Eu?(m.state=Xi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Xi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(wu(function(){o.state===qi&&(o.state=Eu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Al,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Al){for(o.state=qi,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=Tl,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Tl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Xi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Zi(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>Al&&i.state<Tl,i.state=Xi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function xE(e){return this.each(function(){Zi(this,e)})}function IE(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 SE(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 CE(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?IE:SE)(o,e,t))}function Bl(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 Nu(e,t){var o;return(typeof t=="number"?qt:t instanceof No?uu:(o=No(t))?(t=o,uu):dE)(e,t)}function RE(e){return function(){this.removeAttribute(e)}}function VE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AE(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 TE(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 ME(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 BE(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 DE(e,t){var o=Oi(e),i=o==="transform"?pE:Nu;return this.attrTween(e,typeof t=="function"?(o.local?BE:ME)(o,i,Bl(this,"attr."+e,t)):t==null?(o.local?VE:RE)(o):(o.local?TE:AE)(o,i,t))}function OE(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function LE(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function PE(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 zE(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&OE(e,l)),o}return a._value=t,a}function UE(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=Oi(e);return this.tween(o,(i.local?PE:zE)(i,t))}function HE(e,t){return function(){Ml(this,e).delay=+t.apply(this,arguments)}}function FE(e,t){return t=+t,function(){Ml(this,e).delay=t}}function GE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?HE:FE)(t,e)):ht(this.node(),t).delay}function YE(e,t){return function(){Nt(this,e).duration=+t.apply(this,arguments)}}function WE(e,t){return t=+t,function(){Nt(this,e).duration=t}}function KE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?YE:WE)(t,e)):ht(this.node(),t).duration}function qE(e,t){if(typeof t!="function")throw new Error;return function(){Nt(this,e).ease=t}}function XE(e){var t=this._id;return arguments.length?this.each(qE(t,e)):ht(this.node(),t).ease}function jE(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Nt(this,e).ease=o}}function ZE(e){if(typeof e!="function")throw new Error;return this.each(jE(this._id,e))}function JE(e){typeof e!="function"&&(e=Fd(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 QE(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 eN(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 tN(e,t,o){var i,a,l=eN(t)?Ml:Nt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function nN(e,t){var o=this._id;return arguments.length<2?ht(this.node(),o).on.on(e):this.each(tN(o,e,t))}function oN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function iN(){return this.on("end.remove",oN(this._id))}function aN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=wl(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,ji(d[p],t,o,p,d,ht(u,o)));return new Mt(l,this._parents,t,o)}function lN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Hd(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])&&ji(m,t,o,b,p,h);l.push(p),r.push(u)}return new Mt(l,r,t,o)}var rN=wo.prototype.constructor;function sN(){return new rN(this._groups,this._parents)}function cN(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 $u(e){return function(){this.style.removeProperty(e)}}function dN(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 uN(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 fN(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=$u(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function mN(e,t,o){var i=(e+="")=="transform"?mE:Nu;return t==null?this.styleTween(e,cN(e,i)).on("end.style."+e,$u(e)):typeof t=="function"?this.styleTween(e,uN(e,i,Bl(this,"style."+e,t))).each(fN(this._id,e)):this.styleTween(e,dN(e,i,t),o).on("end.style."+e,null)}function pN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function hN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&pN(e,r,o)),i}return l._value=t,l}function yN(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,hN(e,t,o??""))}function gN(e){return function(){this.textContent=e}}function bN(e){return function(){var t=e(this);this.textContent=t??""}}function _N(e){return this.tween("text",typeof e=="function"?bN(Bl(this,"text",e)):gN(e==null?"":e+""))}function wN(e){return function(t){this.textContent=e.call(this,t)}}function vN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&wN(a)),t}return i._value=e,i}function kN(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,vN(e))}function EN(){for(var e=this._name,t=this._id,o=xu(),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);ji(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 NN(){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 $N=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function xu(){return++$N}var Bt=wo.prototype;Mt.prototype={constructor:Mt,select:aN,selectAll:lN,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:JE,merge:QE,selection:sN,transition:EN,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:nN,attr:DE,attrTween:UE,style:mN,styleTween:yN,text:_N,textTween:kN,remove:iN,tween:CE,delay:GE,duration:KE,ease:XE,easeVarying:ZE,end:NN,[Symbol.iterator]:Bt[Symbol.iterator]};function xN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var IN={time:null,delay:0,duration:250,ease:xN};function SN(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 CN(e){var t,o;e instanceof Mt?(t=e._id,e=e._name):(t=xu(),(o=IN).time=Rl(),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])&&ji(c,e,t,d,r,o||SN(c,t));return new Mt(i,this._parents,e,t)}wo.prototype.interrupt=xE,wo.prototype.transition=CN;const Ji=e=>()=>e;function RN(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 Dl=new Dt(1,0,0);Dt.prototype;function Ol(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function VN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function AN(){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 Iu(){return this.__zoom||Dl}function TN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function MN(){return navigator.maxTouchPoints||"ontouchstart"in this}function BN(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 DN(){var e=VN,t=AN,o=BN,i=TN,a=MN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=bE,d=bl("start","zoom","end"),u,f,p,m=500,h=150,b=0,g=10;function _(v){v.property("__zoom",Iu).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",Iu),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(Dl.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 RN(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)],Zi(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;Yk(v.view),Ol(v),P.mouse=[oe,this.__zoom.invert(oe)],Zi(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),Wk(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(Ol(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)),Zi(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(Ol(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:Ji(+v),_):i},_.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Ji(!!v),_):e},_.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:Ji(!!v),_):a},_.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Ji([[+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 Su=Symbol("MiniMapSlots"),ON=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],LN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},PN=n.defineComponent({...LN,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(Su),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,ON))],64)):n.createCommentVNode("",!0)}}),zN=["width","height","viewBox","aria-labelledby"],UN=["id"],HN=["d","fill","stroke","stroke-width"],FN={name:"MiniMap",compatConfig:{MODE:3}},GN=n.defineComponent({...FN,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(Su,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(()=>Ja(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?Pg(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}
48
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class it extends Error{constructor(t,...o){var i;super((i=au[t])==null?void 0:i.call(au,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Kr(e){return"clientX"in e}function I1(e){return"sourceEvent"in e}function Ot(e,t){const o=Kr(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const Yo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function C1(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function ia(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const S1=()=>!0;function Yr(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function $1(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of t.values())ea(a,Qi(r))>0&&i.push(r);return i}const R1=250;function A1(e,t,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=$1(e,o,t+R1);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:f,y:p}=oo(d,m,m.position,!0),y=Math.sqrt((f-e.x)**2+(p-e.y)**2);y>t||(y<s?(l=[{...m,x:f,y:p}],s=y):y===s&&l.push({...m,x:f,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function ru(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=S1},u,m,f,p){const y=r==="target",g=t?l.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:_,y:b}=Ot(e),N=l.elementFromPoint(_,b),h=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,k={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const P=lu(void 0,h),A=h.getAttribute("data-nodeid"),G=h.getAttribute("data-handleid"),K=h.classList.contains("connectable"),v=h.classList.contains("connectableend");if(!A||!P)return k;const T={source:y?A:i,sourceHandle:y?G:a,target:y?i:A,targetHandle:y?a:G};k.connection=T;const C=K&&v&&(o===Kt.Strict?y&&P==="source"||!y&&P==="target":A!==i||G!==a);k.isValid=C&&d(T,{nodes:m,edges:u,sourceNode:f(T.source),targetNode:f(T.target)}),k.toHandle=su(A,P,G,p,o,!0)}return k}function lu(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function T1(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function V1(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function su(e,t,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Kt.Strict?(l=d.handleBounds)==null?void 0:l[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(f=>f.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...oo(d,m,m.position,!0)}:m}const Wr={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top},M1=["production","prod"];function Wo(e,...t){cu()&&console.warn(`[Vue Flow]: ${e}`,...t)}function cu(){return!M1.includes(process.env.NODE_ENV||"")}function du(e,t,o,i,a){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...ta(l)}}):null}function qr(e,t,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&t)&&(i([e]),n.nextTick(()=>{l.blur()})):o([e])}function tt(e){return typeof n.unref(e)<"u"}function B1(e,t,o,i){if(!e||!e.source||!e.target)return o(new it(et.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return nn(e)?a=e:a={...e,id:Hd(e)},a=Ud(a,void 0,i),h1(a,t)?!1:a}function D1(e,t,o,i,a){if(!t.source||!t.target)return a(new it(et.EDGE_INVALID,e.id)),!1;if(!o)return a(new it(et.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Hd(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function uu(e,t,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!vn(l)){o(new it(et.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=m1(l,t(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=t(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new it(et.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function mu(e,t,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,t)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,t)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,t))}}function Xr(e,t,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;mu("source",c,u,e,a,l),mu("target",c,d,e,r,s)}}function fu(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Jr(e,t,o,i,a,r,l,s){const c=[];for(const d of e){const u=nn(d)?d:B1(d,s,a,r);if(!u)continue;const m=o(u.source),f=o(u.target);if(!m||!f){a(new it(et.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new it(et.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){a(new it(et.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:l,sourceNode:m,targetNode:f})){a(new it(et.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...Ud(u,p,r),sourceNode:m,targetNode:f})}return c}const pu=Symbol("vueFlow"),hu=Symbol("nodeId"),yu=Symbol("nodeRef"),O1=Symbol("edgeId"),L1=Symbol("edgeRef"),aa=Symbol("slots");function gu(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:f,findNode:p,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:b,addSelectedNodes:N,updateNodePositions:h,emits:k}=He(),{onStart:P,onDrag:A,onStop:G,onClick:K,el:v,disabled:T,id:H,selectable:C,dragHandle:ae}=e,E=n.shallowRef(!1);let Y=[],S,W=null,ee={x:void 0,y:void 0},ie={x:0,y:0},O=null,U=!1,ne=!1,ce=0,ge=!1;const se=U1(),pe=({x:ke,y:we})=>{ee={x:ke,y:we};let j=!1;if(Y=Y.map(L=>{const x={x:ke-L.distance.x,y:we-L.distance.y},{computedPosition:R}=jr(L,o.value?ia(x,i.value):x,k.error,l.value,L.parentNode?p(L.parentNode):void 0);return j=j||L.position.x!==R.x||L.position.y!==R.y,L.position=R,L}),ne=ne||j,!!j&&(h(Y,!0,!0),E.value=!0,O)){const[L,x]=Gr({id:H,dragItems:Y,findNode:p});A({event:O,node:L,nodes:x})}},be=()=>{if(!W)return;const[ke,we]=Xd(ie,W,u.value);if(ke!==0||we!==0){const j={x:(ee.x??0)-ke/c.value.zoom,y:(ee.y??0)-we/c.value.zoom};f({x:ke,y:we})&&pe(j)}ce=requestAnimationFrame(be)},xe=(ke,we)=>{U=!0;const j=p(H);!_.value&&!y.value&&j&&(j.selected||b()),j&&n.toValue(C)&&_.value&&qr(j,y.value,N,b,g,!1,we);const L=se(ke.sourceEvent);if(ee=L,Y=k1(r.value,m.value,L,H),Y.length){const[x,R]=Gr({id:H,dragItems:Y,findNode:p});P({event:ke.sourceEvent,node:x,nodes:R})}},Te=(ke,we)=>{var j;ke.sourceEvent.type==="touchmove"&&ke.sourceEvent.touches.length>1||(ne=!1,s.value===0&&xe(ke,we),ee=se(ke.sourceEvent),W=((j=t.value)==null?void 0:j.getBoundingClientRect())||null,ie=Ot(ke.sourceEvent,W))},Ae=(ke,we)=>{const j=se(ke.sourceEvent);if(!ge&&U&&d.value&&(ge=!0,be()),!U){const L=j.xSnapped-(ee.x??0),x=j.ySnapped-(ee.y??0);Math.sqrt(L*L+x*x)>s.value&&xe(ke,we)}(ee.x!==j.xSnapped||ee.y!==j.ySnapped)&&Y.length&&U&&(O=ke.sourceEvent,ie=Ot(ke.sourceEvent,W),pe(j))},fe=ke=>{let we=!1;if(!U&&!E.value&&!y.value){const j=ke.sourceEvent,L=se(j),x=L.xSnapped-(ee.x??0),R=L.ySnapped-(ee.y??0),V=Math.sqrt(x*x+R*R);V!==0&&V<=s.value&&(K==null||K(j),we=!0)}if(Y.length&&!we){ne&&(h(Y,!1,!1),ne=!1);const[j,L]=Gr({id:H,dragItems:Y,findNode:p});G({event:ke.sourceEvent,node:j,nodes:L})}Y=[],E.value=!1,ge=!1,U=!1,ee={x:void 0,y:void 0},cancelAnimationFrame(ce)};return n.watch([()=>n.toValue(T),v],([ke,we],j,L)=>{if(we){const x=vt(we);ke||(S=ub().on("start",R=>Te(R,we)).on("drag",R=>Ae(R,we)).on("end",R=>fe(R)).filter(R=>{const V=R.target,Q=n.toValue(ae);return!R.button&&(!a.value||!nu(V,`.${a.value}`,we)&&(!Q||nu(V,Q,we)))}),x.call(S)),L(()=>{x.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function P1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),updateStart:Se(),update:Se(),updateEnd:Se()}}function z1(e,t){const o=P1();return o.doubleClick.on(i=>{var a,r;t.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;t.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;t.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;t.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function U1(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=He();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=I1(a)?a.sourceEvent:a,{x:c,y:d}=Ot(s,l),u=jo({x:c,y:d},e.value),{x:m,y:f}=o.value?ia(u,t.value):u;return{xSnapped:m,ySnapped:f,...u}}}function ra(){return!0}function bu({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:f,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:b,startConnection:N,updateConnection:h,endConnection:k,emits:P,viewport:A,edges:G,nodes:K,isValidConnection:v,nodeLookup:T}=He();let H=null,C=!1,ae=null;function E(S){var W;const ee=n.toValue(o)==="target",ie=Kr(S),O=zd(S.target),U=S.currentTarget;if(U&&(ie&&S.button===0||!ie)){let ne=function(Ee){j=Ot(Ee,fe),pe=A1(jo(j,A.value,!1,[1,1]),u.value,T.value,R),L||(x(),L=!0);const $e=ru(Ee,{handle:pe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:ee?"target":"source",isValidConnection:se,doc:O,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value);ae=$e.handleDomNode,H=$e.connection,C=V1(!!pe,$e.isValid);const Me={...ve,isValid:C,to:$e.toHandle&&C?Go({x:$e.toHandle.x,y:$e.toHandle.y},A.value):j,toHandle:$e.toHandle,toPosition:C&&$e.toHandle?$e.toHandle.position:Wr[R.position],toNode:$e.toHandle?T.value.get($e.toHandle.nodeId):null};if(C&&pe&&(ve!=null&&ve.toHandle)&&Me.toHandle&&ve.toHandle.type===Me.toHandle.type&&ve.toHandle.nodeId===Me.toHandle.nodeId&&ve.toHandle.id===Me.toHandle.id&&ve.to.x===Me.to.x&&ve.to.y===Me.to.y)return;const Ue=pe??$e.toHandle;if(h(Ue&&C?Go({x:Ue.x,y:Ue.y},A.value):j,Ue,T1(!!Ue,C)),ve=Me,!pe&&!C&&!ae)return Yr(we);H&&H.source!==H.target&&ae&&(Yr(we),we=ae,ae.classList.add("connecting","vue-flow__handle-connecting"),ae.classList.toggle("valid",!!C),ae.classList.toggle("vue-flow__handle-valid",!!C))},ce=function(Ee){"touches"in Ee&&Ee.touches.length>0||((pe||ae)&&H&&C&&(r?r(Ee,H):P.connect(H)),P.connectEnd(Ee),a&&(l==null||l(Ee)),Yr(we),cancelAnimationFrame(be),k(Ee),L=!1,C=!1,H=null,ae=null,O.removeEventListener("mousemove",ne),O.removeEventListener("mouseup",ce),O.removeEventListener("touchmove",ne),O.removeEventListener("touchend",ce))};const ge=_(n.toValue(t));let se=n.toValue(i)||v.value||ra;!se&&ge&&(se=(ee?ge.isValidSourcePos:ge.isValidTargetPos)||ra);let pe,be=0;const{x:xe,y:Te}=Ot(S),Ae=lu(n.toValue(a),U),fe=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!fe||!Ae)return;const ke=su(n.toValue(t),Ae,n.toValue(e),T.value,d.value);if(!ke)return;let we,j=Ot(S,fe),L=!1;const x=()=>{if(!y.value)return;const[Ee,$e]=Xd(j,fe,g.value);b({x:Ee,y:$e}),be=requestAnimationFrame(x)},R={...ke,nodeId:n.toValue(t),type:Ae,position:ke.position},V=T.value.get(n.toValue(t)),me={inProgress:!0,isValid:null,from:oo(V,R,Re.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:V,to:j,toHandle:null,toPosition:Wr[R.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Ae,position:(U==null?void 0:U.getAttribute("data-handlepos"))||Re.Top,...j},{x:xe-fe.left,y:Te-fe.top}),P.connectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ae});let ve=me;O.addEventListener("mousemove",ne),O.addEventListener("mouseup",ce),O.addEventListener("touchmove",ne),O.addEventListener("touchend",ce)}}function Y(S){var W,ee;if(!m.value)return;const ie=n.toValue(o)==="target";if(!f.value){P.clickConnectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Re.Top,...Ot(S)},void 0,!0);return}let O=n.toValue(i)||v.value||ra;const U=_(n.toValue(t));if(!O&&U&&(O=(ie?U.isValidSourcePos:U.isValidTargetPos)||ra),U&&(typeof U.connectable>"u"?p.value:U.connectable)===!1)return;const ne=zd(S.target),ce=ru(S,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Re.Top,...Ot(S)},connectionMode:d.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:O,doc:ne,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value),ge=((W=ce.connection)==null?void 0:W.source)===((ee=ce.connection)==null?void 0:ee.target);ce.isValid&&ce.connection&&!ge&&P.connect(ce.connection),P.clickConnectEnd(S),k(S,!0)}return{handlePointerDown:E,handleClick:Y}}function F1(){return n.inject(hu,"")}function _u(e){const t=e??F1()??"",o=n.inject(yu,n.ref(null)),{findNode:i,edges:a,emits:r}=He(),l=i(t);return l||r.error(new it(et.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:l,parentNode:n.computed(()=>i(l.parentNode)),connectedEdges:n.computed(()=>xn([l],a.value))}}function H1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),dragStart:Se(),drag:Se(),dragStop:Se()}}function G1(e,t){const o=H1();return o.doubleClick.on(i=>{var a,r;t.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;t.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;t.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;t.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function ku(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=He();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,f=d?4:1,p=c.x*u*f,y=c.y*m*f,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const b={x:_.computedPosition.x+p,y:_.computedPosition.y+y},{position:N}=jr(_,b,s.error,t.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const la=.1,j1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function rn(){return Wo("Viewport not initialized yet."),Promise.resolve(!1)}const K1={zoomIn:rn,zoomOut:rn,zoomTo:rn,fitView:rn,setCenter:rn,fitBounds:rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:rn,setTransform:rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Y1(e){function t(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Bo:Hi).scaleBy(Zr(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=Pd({x:-i,y:-a},e.translateExtent),m=eo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Bo:Hi).transform(Zr(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?Bo:Hi).scaleTo(Zr(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:la,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!f.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const c=Ur(s),{x:d,y:u,zoom:m}=Yd(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??la);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:la})=>{const{x:l,y:s,zoom:c}=Yd(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??la);return o(l,s,c,r)},project:a=>jo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return jo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return Go(s,e.viewport)}return{x:0,y:0}}}:K1)}function Zr(e,t=0,o=j1,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function W1(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,b=!!(o.nodes.value.length||o.edges.value.length);g=qn([e.modelValue,()=>{var N,h;return(h=(N=e.modelValue)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,h])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...h],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,b=!!o.nodes.value.length;g=qn([e.nodes,()=>{var N,h;return(h=(N=e.nodes)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,()=>o.nodes.value.length],([N])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,b=!!o.edges.value.length;g=qn([e.edges,()=>{var N,h;return(h=(N=e.edges)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.edges,()=>o.edges.value.length],([N])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&tt(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&tt(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&tt(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&tt(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{tt(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{i.run(()=>{const g=async _=>{let b=_;typeof t.autoConnect=="function"&&(b=await t.autoConnect(_)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{tt(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(_,b,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},p=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(t)){const b=_;if(!g.includes(b)){const N=n.toRef(()=>t[b]),h=o[b];n.isRef(h)&&i.run(()=>{n.watch(N,k=>{tt(k)&&(h.value=k)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),f(),p()})()}),()=>i.stop()}function q1(){return{edgesChange:Se(),nodesChange:Se(),nodeDoubleClick:Se(),nodeClick:Se(),nodeMouseEnter:Se(),nodeMouseMove:Se(),nodeMouseLeave:Se(),nodeContextMenu:Se(),nodeDragStart:Se(),nodeDrag:Se(),nodeDragStop:Se(),nodesInitialized:Se(),miniMapNodeClick:Se(),miniMapNodeDoubleClick:Se(),miniMapNodeMouseEnter:Se(),miniMapNodeMouseMove:Se(),miniMapNodeMouseLeave:Se(),connect:Se(),connectStart:Se(),connectEnd:Se(),clickConnectStart:Se(),clickConnectEnd:Se(),paneReady:Se(),init:Se(),move:Se(),moveStart:Se(),moveEnd:Se(),selectionDragStart:Se(),selectionDrag:Se(),selectionDragStop:Se(),selectionContextMenu:Se(),selectionStart:Se(),selectionEnd:Se(),viewportChangeStart:Se(),viewportChange:Se(),viewportChangeEnd:Se(),paneScroll:Se(),paneClick:Se(),paneContextMenu:Se(),paneMouseEnter:Se(),paneMouseMove:Se(),paneMouseLeave:Se(),edgeContextMenu:Se(),edgeMouseEnter:Se(),edgeMouseMove:Se(),edgeMouseLeave:Se(),edgeDoubleClick:Se(),edgeClick:Se(),edgeUpdateStart:Se(),edgeUpdate:Se(),edgeUpdateEnd:Se(),updateNodeInternals:Se(),error:Se(e=>Wo(e.message))}}function X1(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,r]of Object.entries(t.value)){const l=s=>{e(a,s)};r.setEmitter(l),$o(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),$o(r.removeHasEmitListeners)}});function i(a){var r;const l=J1(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function J1(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Eu(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Lr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Uo.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Nn.Bezier,style:{}},connectionMode:Kt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Yo()?"Meta":"Control",zoomActivationKeyCode:Yo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:q1(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const Z1=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Q1(e,t,o){const i=Y1(e),a=j=>{const L=j??[];e.hooks.updateNodeInternals.trigger(L)},r=j=>p1(j,e.nodes,e.edges),l=j=>f1(j,e.nodes,e.edges),s=j=>xn(j,e.edges),c=({id:j,type:L,nodeId:x})=>{var R;const V=j?`-${L}-${j}`:`-${L}`;return Array.from(((R=e.connectionLookup.get(`${x}${V}`))==null?void 0:R.values())??[])},d=j=>{if(j)return t.value.get(j)},u=j=>{if(j)return o.value.get(j)},m=(j,L,x)=>{var R,V;const Q=[];for(const me of j){const ve={id:me.id,type:"position",dragging:x,from:me.from};if(L&&(ve.position=me.position,me.parentNode)){const Ee=d(me.parentNode);ve.position={x:ve.position.x-(((R=Ee==null?void 0:Ee.computedPosition)==null?void 0:R.x)??0),y:ve.position.y-(((V=Ee==null?void 0:Ee.computedPosition)==null?void 0:V.y)??0)}}Q.push(ve)}Q!=null&&Q.length&&e.hooks.nodesChange.trigger(Q)},f=j=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const x=window.getComputedStyle(L),{m22:R}=new window.DOMMatrixReadOnly(x.transform),V=[];for(const Q of j){const me=Q,ve=d(me.id);if(ve){const Ee=ta(me.nodeElement);if(!!(Ee.width&&Ee.height&&(ve.dimensions.width!==Ee.width||ve.dimensions.height!==Ee.height||me.forceUpdate))){const Me=me.nodeElement.getBoundingClientRect();ve.dimensions=Ee,ve.handleBounds.source=du("source",me.nodeElement,Me,R,ve.id),ve.handleBounds.target=du("target",me.nodeElement,Me,R,ve.id),V.push({id:ve.id,type:"dimensions",dimensions:Ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),V.length&&e.hooks.nodesChange.trigger(V)},p=(j,L)=>{const x=new Set,R=new Set;for(const me of j)vn(me)?x.add(me.id):nn(me)&&R.add(me.id);const V=an(t.value,x,!0),Q=an(o.value,R);if(e.multiSelectionActive){for(const me of x)V.push(on(me,L));for(const me of R)Q.push(on(me,L))}V.length&&e.hooks.nodesChange.trigger(V),Q.length&&e.hooks.edgesChange.trigger(Q)},y=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(an(t.value,new Set(j.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(an(o.value))},g=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(an(o.value,new Set(j.map(L=>L.id)))),e.hooks.nodesChange.trigger(an(t.value,new Set,!0))},_=j=>{p(j,!0)},b=j=>{const x=(j||e.nodes).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.nodesChange.trigger(x)},N=j=>{const x=(j||e.edges).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.edgesChange.trigger(x)},h=j=>{if(!j||!j.length)return p([],!1);const L=j.reduce((x,R)=>{const V=on(R.id,!1);return vn(R)?x.nodes.push(V):x.edges.push(V),x},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},k=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([j,e.maxZoom]),e.minZoom=j},P=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,j]),e.maxZoom=j},A=j=>{var L;(L=e.d3Zoom)==null||L.translateExtent(j),e.translateExtent=j},G=j=>{e.nodeExtent=j,a()},K=j=>{var L;(L=e.d3Zoom)==null||L.clickDistance(j)},v=j=>{e.nodesDraggable=j,e.nodesConnectable=j,e.elementsSelectable=j},T=j=>{const L=j instanceof Function?j(e.nodes):j;!e.initialized&&!L.length||(e.nodes=uu(L,d,e.hooks.error.trigger))},H=j=>{const L=j instanceof Function?j(e.edges):j;if(!e.initialized&&!L.length)return;const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Xr(e.connectionLookup,o.value,x),e.edges=x},C=j=>{const L=j instanceof Function?j([...e.nodes,...e.edges]):j;!e.initialized&&!L.length||(T(L.filter(vn)),H(L.filter(nn)))},ae=j=>{let L=j instanceof Function?j(e.nodes):j;L=Array.isArray(L)?L:[L];const x=uu(L,d,e.hooks.error.trigger),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.nodesChange.trigger(R)},E=j=>{let L=j instanceof Function?j(e.edges):j;L=Array.isArray(L)?L:[L];const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.edgesChange.trigger(R)},Y=(j,L=!0,x=!1)=>{const R=j instanceof Function?j(e.nodes):j,V=Array.isArray(R)?R:[R],Q=[],me=[];function ve($e){const Me=s($e);for(const Ue of Me)(!tt(Ue.deletable)||Ue.deletable)&&me.push(eu(Ue.id,Ue.source,Ue.target,Ue.sourceHandle,Ue.targetHandle))}function Ee($e){const Me=[];for(const Ue of e.nodes)Ue.parentNode===$e&&Me.push(Ue);if(Me.length){for(const Ue of Me)Q.push(Qd(Ue.id));L&&ve(Me);for(const Ue of Me)Ee(Ue.id)}}for(const $e of V){const Me=typeof $e=="string"?d($e):$e;Me&&(tt(Me.deletable)&&!Me.deletable||(Q.push(Qd(Me.id)),L&&ve([Me]),x&&Ee(Me.id)))}me.length&&e.hooks.edgesChange.trigger(me),Q.length&&e.hooks.nodesChange.trigger(Q)},S=j=>{const L=j instanceof Function?j(e.edges):j,x=Array.isArray(L)?L:[L],R=[];for(const V of x){const Q=typeof V=="string"?u(V):V;Q&&(tt(Q.deletable)&&!Q.deletable||R.push(eu(typeof V=="string"?V:V.id,Q.source,Q.target,Q.sourceHandle,Q.targetHandle)))}e.hooks.edgesChange.trigger(R)},W=(j,L,x=!0)=>{const R=u(j.id);if(!R)return!1;const V=e.edges.indexOf(R),Q=D1(j,L,R,x,e.hooks.error.trigger);if(Q){const[me]=Jr([Q],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ve,Ee)=>Ee===V?me:ve),Xr(e.connectionLookup,o.value,[me]),me}return!1},ee=(j,L,x={replace:!1})=>{const R=u(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ie=j=>Jd(j,e.nodes),O=j=>{const L=Jd(j,e.edges);return Xr(e.connectionLookup,o.value,L),L},U=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;x.replace?e.nodes.splice(e.nodes.indexOf(R),1,V):Object.assign(R,V)},ne=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ce=(j,L,x=!1)=>{x?e.connectionClickStartHandle=j:e.connectionStartHandle=j,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},ge=(j,L=null,x=null)=>{e.connectionStartHandle&&(e.connectionPosition=j,e.connectionEndHandle=L,e.connectionStatus=x)},se=(j,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},pe=j=>{const L=u1(j),x=L?null:Ho(j)?j:d(j.id);return!L&&!x?[null,null,L]:[L?j:Qi(x),x,L]},be=(j,L=!0,x=e.nodes)=>{const[R,V,Q]=pe(j);if(!R)return[];const me=[];for(const ve of x||e.nodes){if(!Q&&(ve.id===V.id||!ve.computedPosition))continue;const Ee=Qi(ve),$e=ea(Ee,R);(L&&$e>0||$e>=Ee.width*Ee.height||$e>=Number(R.width)*Number(R.height))&&me.push(ve)}return me},xe=(j,L,x=!0)=>{const[R]=pe(j);if(!R)return!1;const V=ea(R,L);return x&&V>0||V>=Number(R.width)*Number(R.height)},Te=j=>{const{viewport:L,dimensions:x,d3Zoom:R,d3Selection:V,translateExtent:Q}=e;if(!R||!V||!j.x&&!j.y)return!1;const me=eo.translate(L.x+j.x,L.y+j.y).scale(L.zoom),ve=[[0,0],[x.width,x.height]],Ee=R.constrain()(me,ve,Q),$e=e.viewport.x!==Ee.x||e.viewport.y!==Ee.y||e.viewport.zoom!==Ee.k;return R.transform(V,Ee),$e},Ae=j=>{const L=j instanceof Function?j(e):j,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];tt(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const R=L.modelValue||L.nodes||L.edges?[]:void 0;R&&(L.modelValue&&R.push(...L.modelValue),L.nodes&&R.push(...L.nodes),L.edges&&R.push(...L.edges),C(R));const V=()=>{tt(L.maxZoom)&&P(L.maxZoom),tt(L.minZoom)&&k(L.minZoom),tt(L.translateExtent)&&A(L.translateExtent)};for(const Q of Object.keys(L)){const me=Q,ve=L[me];![...Z1,...x].includes(me)&&tt(ve)&&(e[me]=ve)}gr(()=>e.d3Zoom).not.toBeNull().then(V),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:f,setElements:C,setNodes:T,setEdges:H,addNodes:ae,addEdges:E,removeNodes:Y,removeEdges:S,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:ee,updateNode:U,updateNodeData:ne,applyEdgeChanges:O,applyNodeChanges:ie,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:k,setMaxZoom:P,setTranslateExtent:A,setNodeExtent:G,setPaneClickDistance:K,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:N,startConnection:ce,updateConnection:ge,endConnection:se,setInteractive:v,setState:Ae,getIntersectingNodes:be,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:xe,panBy:Te,fitView:j=>i.value.fitView(j),zoomIn:j=>i.value.zoomIn(j),zoomOut:j=>i.value.zoomOut(j),zoomTo:(j,L)=>i.value.zoomTo(j,L),setViewport:(j,L)=>i.value.setViewport(j,L),setTransform:(j,L)=>i.value.setTransform(j,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(j,L,x)=>i.value.setCenter(j,L,x),fitBounds:(j,L)=>i.value.fitBounds(j,L),project:j=>i.value.project(j),screenToFlowCoordinate:j=>i.value.screenToFlowCoordinate(j),flowToScreenCoordinate:j=>i.value.flowToScreenCoordinate(j),toObject:()=>{const j=[],L=[];for(const x of e.nodes){const{computedPosition:R,handleBounds:V,selected:Q,dimensions:me,isParent:ve,resizing:Ee,dragging:$e,events:Me,...Ue}=x;j.push(Ue)}for(const x of e.edges){const{selected:R,sourceNode:V,targetNode:Q,events:me,...ve}=x;L.push(ve)}return JSON.parse(JSON.stringify({nodes:j,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:j=>new Promise(L=>{const{nodes:x,edges:R,position:V,zoom:Q,viewport:me}=j;x&&T(x),R&&H(R);const[ve,Ee]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:V??[null,null];if(ve&&Ee){const $e=(me==null?void 0:me.zoom)||Q||e.viewport.zoom;return gr(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ve,y:Ee,zoom:$e}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const j=Eu();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=eo.translate(j.defaultViewport.x??0,j.defaultViewport.y??0).scale(wn(j.defaultViewport.zoom??1,j.minZoom,j.maxZoom)),x=e.viewportRef.getBoundingClientRect(),R=[[0,0],[x.width,x.height]],V=e.d3Zoom.constrain()(L,R,j.translateExtent);e.d3Zoom.transform(e.d3Selection,V)}Ae(j)},$destroy:()=>{}}}const e0=["data-id","data-handleid","data-nodeid","data-handlepos"],t0={name:"Handle",compatConfig:{MODE:3}},In=n.defineComponent({...t0,props:{id:{default:null},type:{},position:{default:()=>Re.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:f}=He(),{id:p,node:y,nodeEl:g,connectedEdges:_}=_u(),b=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=n.toRef(()=>{var H,C,ae,E,Y,S;return((H=l.value)==null?void 0:H.nodeId)===p&&((C=l.value)==null?void 0:C.id)===e.id&&((ae=l.value)==null?void 0:ae.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),P=n.toRef(()=>{var H,C,ae;return((H=s.value)==null?void 0:H.nodeId)===p&&((C=s.value)==null?void 0:C.id)===e.id&&((ae=s.value)==null?void 0:ae.type)===i.value}),{handlePointerDown:A,handleClick:G}=bu({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),K=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}):typeof e.connectable=="number"?_.value.filter(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):tt(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var H;if(!y.dimensions.width||!y.dimensions.height)return;const C=(H=y.handleBounds[i.value])==null?void 0:H.find(ie=>ie.id===e.id);if(!d.value||C)return;const ae=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!ae||!e.id)return;const E=g.value.getBoundingClientRect(),Y=b.value.getBoundingClientRect(),S=window.getComputedStyle(ae),{m22:W}=new window.DOMMatrixReadOnly(S.transform),ee={id:e.id,position:e.position,x:(Y.left-E.left)/W,y:(Y.top-E.top)/W,type:i.value,nodeId:p,...ta(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],ee]});function v(H){const C=Kr(H);K.value&&N.value&&(C&&H.button===0||!C)&&A(H)}function T(H){!p||!s.value&&!N.value||K.value&&G(H)}return t({handleClick:G,handlePointerDown:A,onClick:T,onPointerDown:v}),(H,C)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(r)}-${n.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(p),"data-handlepos":H.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${H.position}`,`vue-flow__handle-${e.id}`,n.unref(m),n.unref(f),i.value,{connectable:K.value,connecting:P.value,connectablestart:N.value,connectableend:h.value,connectionindicator:K.value&&(N.value&&!k.value||h.value&&k.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:T},[n.renderSlot(H.$slots,"default",{id:H.id})],42,e0))}}),sa=function({sourcePosition:e=Re.Bottom,targetPosition:t=Re.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[n.h(In,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(In,{type:"source",position:e,connectable:i,isValidConnection:r})]};sa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],sa.inheritAttrs=!1,sa.compatConfig={MODE:3};const n0=sa,ca=function({targetPosition:e=Re.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??t;return[n.h(In,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r])]};ca.props=["targetPosition","label","isValidTargetPos","connectable","data"],ca.inheritAttrs=!1,ca.compatConfig={MODE:3};const o0=ca,da=function({sourcePosition:e=Re.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??t;return[typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r]),n.h(In,{type:"source",position:e,connectable:o,isValidConnection:i})]};da.props=["sourcePosition","label","isValidSourcePos","connectable","data"],da.inheritAttrs=!1,da.compatConfig={MODE:3};const i0=da,a0=["transform"],r0=["width","height","x","y","rx","ry"],l0=["y"],s0={name:"EdgeText",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:n.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,r0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[n.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(r.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(r.label),1)],64))])],16,l0)],8,a0))}}),d0=["id","d","marker-end","marker-start"],u0=["d","stroke-width"],m0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ua=n.defineComponent({...m0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),r=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,d0),l.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,u0)):n.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(n.openBlock(),n.createBlock(c0,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function Nu({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-t)/2,s=i<t?i+l:i-l;return[r,s,a,l]}function wu({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=t*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-t);return[c,d,u,m]}function ma(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vu({pos:e,x1:t,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Re.Left:l=t-ma(t-i,r),s=o;break;case Re.Right:l=t+ma(i-t,r),s=o;break;case Re.Top:l=t,s=o-ma(o-a,r);break;case Re.Bottom:l=t,s=o+ma(a-o,r);break}return[l,s]}function xu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,curvature:s=.25}=e,[c,d]=vu({pos:i,x1:t,y1:o,x2:a,y2:r,c:s}),[u,m]=vu({pos:l,x1:a,y1:r,x2:t,y2:o,c:s}),[f,p,y,g]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${t},${o} C${c},${d} ${u},${m} ${a},${r}`,f,p,y,g]}function Iu({pos:e,x1:t,y1:o,x2:i,y2:a}){let r,l;switch(e){case Re.Left:case Re.Right:r=.5*(t+i),l=o;break;case Re.Top:case Re.Bottom:r=t,l=.5*(o+a);break}return[r,l]}function Cu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top}=e,[s,c]=Iu({pos:i,x1:t,y1:o,x2:a,y2:r}),[d,u]=Iu({pos:l,x1:a,y1:r,x2:t,y2:o}),[m,f,p,y]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${r}`,m,f,p,y]}const Su={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}};function f0({source:e,sourcePosition:t=Re.Bottom,target:o}){return t===Re.Left||t===Re.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function $u(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function p0({source:e,sourcePosition:t=Re.Bottom,target:o,targetPosition:i=Re.Top,center:a,offset:r}){const l=Su[t],s=Su[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=f0({source:c,sourcePosition:t,target:d}),m=u.x!==0?"x":"y",f=u[m];let p,y,g;const _={x:0,y:0},b={x:0,y:0},[N,h,k,P]=Nu({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??h;const G=[{x:y,y:c.y},{x:y,y:d.y}],K=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===f?p=m==="x"?G:K:p=m==="x"?K:G}else{const G=[{x:c.x,y:d.y}],K=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===f?K:G:p=l.y===f?G:K,t===i){const ae=Math.abs(e[m]-o[m]);if(ae<=r){const E=Math.min(r-1,r-ae);l[m]===f?_[m]=(c[m]>e[m]?-1:1)*E:b[m]=(d[m]>o[m]?-1:1)*E}}if(t!==i){const ae=m==="x"?"y":"x",E=l[m]===s[ae],Y=c[ae]>d[ae],S=c[ae]<d[ae];(l[m]===1&&(!E&&Y||E&&S)||l[m]!==1&&(!E&&S||E&&Y))&&(p=m==="x"?G:K)}const v={x:c.x+_.x,y:c.y+_.y},T={x:d.x+b.x,y:d.y+b.y},H=Math.max(Math.abs(v.x-p[0].x),Math.abs(T.x-p[0].x)),C=Math.max(Math.abs(v.y-p[0].y),Math.abs(T.y-p[0].y));H>=C?(y=(v.x+T.x)/2,g=p[0].y):(y=p[0].x,g=(v.y+T.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...p,{x:d.x+b.x,y:d.y+b.y},o],y,g,k,P]}function h0(e,t,o,i){const a=Math.min($u(e,t)/2,$u(t,o)/2,i),{x:r,y:l}=t;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Qr(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,f,p,y,g]=p0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,N,h)=>{let k;return h>0&&h<m.length-1?k=h0(m[h-1],N,m[h+1],s):k=`${h===0?"M":"L"}${N.x} ${N.y}`,b+=k,b},""),f,p,y,g]}function y0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Nu({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,r,l,s,c]}const g0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=y0(e);return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),Ru=n.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=Qr({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(Ru,{...e,...t,borderRadius:0})}}),_0=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=xu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),k0=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=Cu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),E0={input:i0,default:n0,output:o0},N0={default:_0,straight:g0,step:b0,smoothstep:Ru,simplebezier:k0};function w0(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),r=n.computed(()=>{const g={...N0,...e.edgeTypes},_=Object.keys(g);for(const b of e.edges)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),l=n.computed(()=>{const g={...E0,...e.nodeTypes},_=Object.keys(g);for(const b of e.nodes)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?Kd(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const _ of e.edges){const b=t.value.get(_.source),N=t.value.get(_.target);v1({sourcePos:b.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=n.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),f=n.computed(()=>[...u.value,...m.value]),p=n.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=n.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Cn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Cn.instance;return Cn.instance=i??new Cn,o&&(o.config.globalProperties.$vueFlowStorage=Cn.instance),Cn.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=Eu(),a=n.reactive(i),r={};for(const[f,p]of Object.entries(a.hooks)){const y=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[y]=p.on}const l={};for(const[f,p]of Object.entries(a.hooks))l[f]=p.trigger;const s=n.computed(()=>{const f=new Map;for(const p of a.nodes)f.set(p.id,p);return f}),c=n.computed(()=>{const f=new Map;for(const p of a.edges)f.set(p.id,p);return f}),d=w0(a,s,c),u=Q1(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...ky(a),nodeLookup:s,edgeLookup:c,emits:l,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,m),m}getId(){return`vue-flow-${this.currentId++}`}}function He(e){const t=Cn.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(pu,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const c=r??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(m,f,p)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),$o(()=>{if(s){const m=t.get(s.id);m?m.$destroy():Wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(pu,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new it(et.USEVUEFLOW_OPTIONS))}return s}function v0(e){const{emits:t,dimensions:o}=He();let i;n.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=ta(e.value);(s.width===0||s.height===0)&&t.error(new it(et.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const x0={name:"UserSelection",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),C0=["tabIndex"],S0={name:"NodesSelection",compatConfig:{MODE:3}},$0=n.defineComponent({...S0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=He(),s=ku(),c=n.ref(null),d=gu({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>Ur(i.value)),m=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function f(y){t.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||to[y.key]&&(y.preventDefault(),s({x:to[y.key].x,y:to[y.key].y},y.shiftKey))}return(y,g)=>!n.unref(l)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(m.value),tabIndex:n.unref(r)?void 0:-1,onContextmenu:f,onKeydown:p},null,46,C0)],6)):n.createCommentVNode("",!0)}});function R0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const A0={name:"Pane",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:f,removeEdges:p,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:b,edgeLookup:N,nodeLookup:h,connectionLookup:k,defaultEdgeOptions:P,connectionStartHandle:A,panOnDrag:G}=He(),K=n.shallowRef(null),v=n.shallowRef(new Set),T=n.shallowRef(new Set),H=n.shallowRef(null),C=n.toRef(()=>c.value&&(e.isSelecting||r.value)),ae=n.toRef(()=>A.value!==null);let E=!1,Y=!1;const S=Fo(g,{actInsideInputWithModifier:!1}),W=Fo(_);n.watch(S,se=>{se&&(f(m.value),p(u.value),d.value=!1)}),n.watch(W,se=>{b.value=se});function ee(se,pe){return be=>{be.target===pe&&(se==null||se(be))}}function ie(se){if(E||ae.value){E=!1;return}a.paneClick(se),l(),d.value=!1}function O(se){var pe;if(Array.isArray(G.value)&&((pe=G.value)!=null&&pe.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function U(se){a.paneScroll(se)}function ne(se){var pe,be,xe;if(H.value=((pe=t.value)==null?void 0:pe.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==K.value||!H.value)return;(xe=(be=se.target)==null?void 0:be.setPointerCapture)==null||xe.call(be,se.pointerId);const{x:Te,y:Ae}=R0(se,H.value);Y=!0,E=!1,l(),s.value={width:0,height:0,startX:Te,startY:Ae,x:Te,y:Ae},a.selectionStart(se)}function ce(se){var pe;if(!H.value||!s.value)return;E=!0;const{x:be,y:xe}=Ot(se,H.value),{startX:Te=0,startY:Ae=0}=s.value,fe={startX:Te,startY:Ae,x:be<Te?be:Te,y:xe<Ae?xe:Ae,width:Math.abs(be-Te),height:Math.abs(xe-Ae)},ke=v.value,we=T.value;v.value=new Set(Kd(o.value,fe,i.value,y.value===Lr.Partial,!0).map(L=>L.id)),T.value=new Set;const j=((pe=P.value)==null?void 0:pe.selectable)??!0;for(const L of v.value){const x=k.value.get(L);if(x)for(const{edgeId:R}of x.values()){const V=N.value.get(R);V&&(V.selectable??j)&&T.value.add(R)}}if(!fu(ke,v.value)){const L=an(h.value,v.value,!0);a.nodesChange(L)}if(!fu(we,T.value)){const L=an(N.value,T.value);a.edgesChange(L)}s.value=fe,r.value=!0,d.value=!1}function ge(se){var pe;se.button!==0||!Y||((pe=se.target)==null||pe.releasePointerCapture(se.pointerId),!r.value&&s.value&&se.target===K.value&&ie(se),r.value=!1,s.value=null,d.value=v.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(E=!1),Y=!1)}return(se,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:K,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:pe[0]||(pe[0]=be=>C.value?void 0:ee(ie,K.value)(be)),onContextmenu:pe[1]||(pe[1]=be=>ee(O,K.value)(be)),onWheelPassive:pe[2]||(pe[2]=be=>ee(U,K.value)(be)),onPointerenter:pe[3]||(pe[3]=be=>C.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:pe[4]||(pe[4]=be=>C.value?ne(be):n.unref(a).paneMouseMove(be)),onPointermove:pe[5]||(pe[5]=be=>C.value?ce(be):n.unref(a).paneMouseMove(be)),onPointerup:pe[6]||(pe[6]=be=>C.value?ge(be):void 0),onPointerleave:pe[7]||(pe[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(se.$slots,"default"),n.unref(r)&&n.unref(s)?(n.openBlock(),n.createBlock(I0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(m).length?(n.openBlock(),n.createBlock($0,{key:1})):n.createCommentVNode("",!0)],34))}}),V0={name:"Transform",compatConfig:{MODE:3}},M0=n.defineComponent({...V0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=He(),a=n.computed(()=>o.value?!i.value:!1),r=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[n.renderSlot(l.$slots,"default")],4))}}),B0={name:"Viewport",compatConfig:{MODE:3}},D0=n.defineComponent({...B0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:f,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:b,emits:N,connectionStartHandle:h,userSelectionActive:k,paneDragging:P,d3Zoom:A,d3Selection:G,d3ZoomHandler:K,viewport:v,viewportRef:T,paneClickDistance:H}=He();v0(T);const C=n.shallowRef(!1),ae=n.shallowRef(!1);let E=null,Y=!1,S=0,W={x:0,y:0,zoom:0};const ee=Fo(s),ie=Fo(l),O=Fo(r),U=n.toRef(()=>(!ie.value||ie.value&&l.value===!0)&&(ee.value||m.value)),ne=n.toRef(()=>ee.value||c.value),ce=n.toRef(()=>l.value===!0&&U.value!==!0),ge=n.toRef(()=>ie.value&&l.value!==!0||k.value||ce.value),se=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!T.value){Wo("Viewport element is missing");return}const Ae=T.value,fe=Ae.getBoundingClientRect(),ke=i1().clickDistance(H.value).scaleExtent([t.value,o.value]).translateExtent(a.value),we=vt(Ae).call(ke),j=we.on("wheel.zoom"),L=eo.translate(i.value.x??0,i.value.y??0).scale(wn(i.value.zoom??1,t.value,o.value)),x=[[0,0],[fe.width,fe.height]],R=ke.constrain()(L,x,a.value);ke.transform(we,R),ke.wheelDelta(Fr),A.value=ke,G.value=we,K.value=j,v.value={x:R.x,y:R.y,zoom:R.k},ke.on("start",V=>{var Q;if(!V.sourceEvent)return null;S=V.sourceEvent.button,C.value=!0;const me=xe(V.transform);((Q=V.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(P.value=!0),W=me,N.viewportChangeStart(me),N.moveStart({event:V,flowTransform:me})}),ke.on("end",V=>{if(!V.sourceEvent)return null;if(C.value=!1,P.value=!1,pe(U.value,S??0)&&!Y&&N.paneContextMenu(V.sourceEvent),Y=!1,be(W,V.transform)){const Q=xe(V.transform);W=Q,N.viewportChangeEnd(Q),N.moveEnd({event:V,flowTransform:Q})}}),ke.filter(V=>{var Q;const me=O.value||y.value,ve=p.value&&V.ctrlKey,Ee=V.button,$e=V.type==="wheel";if(Ee===1&&V.type==="mousedown"&&(Te(V,"vue-flow__node")||Te(V,"vue-flow__edge")))return!0;if(!U.value&&!me&&!ne.value&&!f.value&&!p.value||k.value||se.value&&!$e||!f.value&&V.type==="dblclick"||Te(V,_.value)&&$e||Te(V,b.value)&&(!$e||ne.value&&$e&&!O.value)||!p.value&&V.ctrlKey&&$e||!me&&!ne.value&&!ve&&$e)return!1;if(!p&&V.type==="touchstart"&&((Q=V.touches)==null?void 0:Q.length)>1)return V.preventDefault(),!1;if(!U.value&&(V.type==="mousedown"||V.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ee===0||Array.isArray(m.value)&&!m.value.includes(Ee)&&(V.type==="mousedown"||V.type==="touchstart"))return!1;const Me=Array.isArray(m.value)&&m.value.includes(Ee)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ee||Ee<=1;return(!V.ctrlKey||ee.value||$e)&&Me}),n.watch([k,U],()=>{k.value&&!C.value?ke.on("zoom",null):k.value||ke.on("zoom",V=>{v.value={x:V.transform.x,y:V.transform.y,zoom:V.transform.k};const Q=xe(V.transform);Y=pe(U.value,S??0),N.viewportChange(Q),N.move({event:V,flowTransform:Q})})},{immediate:!0}),n.watch([k,ne,d,O,p,g,_],()=>{ne.value&&!O.value&&!k.value?we.on("wheel.zoom",V=>{if(Te(V,_.value))return!1;const Q=O.value||y.value,me=p.value&&V.ctrlKey;if(!(!g.value||ne.value||Q||me))return!1;V.preventDefault(),V.stopImmediatePropagation();const Ee=we.property("__zoom").k||1,$e=Yo();if(!ee.value&&V.ctrlKey&&p.value&&$e){const gt=Vt(V),w=Fr(V),M=Ee*2**w;ke.scaleTo(we,M,gt,V);return}const Me=V.deltaMode===1?20:1;let Ue=d.value===Uo.Vertical?0:V.deltaX*Me,Ye=d.value===Uo.Horizontal?0:V.deltaY*Me;!$e&&V.shiftKey&&d.value!==Uo.Vertical&&!Ue&&Ye&&(Ue=Ye,Ye=0),ke.translateBy(we,-(Ue/Ee)*u.value,-(Ye/Ee)*u.value);const Fe=xe(we.property("__zoom"));E&&clearTimeout(E),ae.value?(N.move({event:V,flowTransform:Fe}),N.viewportChange(Fe),E=setTimeout(()=>{N.moveEnd({event:V,flowTransform:Fe}),N.viewportChangeEnd(Fe),ae.value=!1},150)):(ae.value=!0,N.moveStart({event:V,flowTransform:Fe}),N.viewportChangeStart(Fe))},{passive:!1}):typeof j<"u"&&we.on("wheel.zoom",function(V,Q){const me=!g.value&&V.type==="wheel"&&!V.ctrlKey,ve=O.value||y.value,Ee=p.value&&V.ctrlKey;if(!ve&&!c.value&&!Ee&&V.type==="wheel"||me||Te(V,_.value))return null;V.preventDefault(),j.call(this,V,Q)},{passive:!1})},{immediate:!0})});function pe(Ae,fe){return fe===2&&Array.isArray(Ae)&&Ae.includes(2)}function be(Ae,fe){return Ae.x!==fe.x&&!Number.isNaN(fe.x)||Ae.y!==fe.y&&!Number.isNaN(fe.y)||Ae.zoom!==fe.k&&!Number.isNaN(fe.k)}function xe(Ae){return{x:Ae.x,y:Ae.y,zoom:Ae.k}}function Te(Ae,fe){return Ae.target.closest(`.${fe}`)}return(Ae,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:T,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(T0,{"is-selecting":ge.value,"selection-key-pressed":n.unref(ie),class:n.normalizeClass({connecting:se.value,dragging:n.unref(P),draggable:n.unref(m)===!0||Array.isArray(n.unref(m))&&n.unref(m).includes(0)})},{default:n.withCtx(()=>[n.createVNode(M0,null,{default:n.withCtx(()=>[n.renderSlot(Ae.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),O0=["id"],L0=["id"],P0=["id"],z0={name:"A11yDescriptions",compatConfig:{MODE:3}},U0=n.defineComponent({...z0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Dd)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,O0),n.createElementVNode("div",{id:`${n.unref(Od)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,L0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(d1)}-${n.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},n.toDisplayString(n.unref(i)),9,P0))],64))}});function F0(){const e=He();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function H0(e,t,o){return o===Re.Left?e-t:o===Re.Right?e+t:e}function G0(e,t,o){return o===Re.Top?e-t:o===Re.Bottom?e+t:e}const el=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Re.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:H0(t,e,i),cy:G0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};el.props=["radius","centerX","centerY","position","type"],el.compatConfig={MODE:3};const Au=el,j0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:f,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:b,hooks:N}=He(),h=n.computed(()=>u(e.id)),{emit:k,on:P}=z1(h.value,r),A=n.inject(aa),G=n.getCurrentInstance(),K=n.ref(!1),v=n.ref(!1),T=n.ref(""),H=n.ref(null),C=n.ref("source"),ae=n.ref(null),E=n.toRef(()=>typeof h.value.selectable>"u"?g.value:h.value.selectable),Y=n.toRef(()=>typeof h.value.updatable>"u"?_.value:h.value.updatable),S=n.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);n.provide(O1,e.id),n.provide(L1,ae);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),ee=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),ie=n.computed(()=>{const L=h.value.type||"default",x=A==null?void 0:A[`edge-${L}`];if(x)return x;let R=h.value.template??c.value[L];if(typeof R=="string"&&G){const V=Object.keys(G.appContext.components);V&&V.includes(L)&&(R=n.resolveComponent(L,!1))}return R&&typeof R!="string"?R:(r.error(new it(et.EDGE_TYPE_MISSING,R)),!1)}),{handlePointerDown:O}=bu({nodeId:T,handleId:H,type:C,isValidConnection:f,edgeUpdaterType:C,onEdgeUpdate:ce,onEdgeUpdateEnd:ge});return()=>{const L=m(h.value.source),x=m(h.value.target),R="pathOptions"in h.value?h.value.pathOptions:{};if(!L&&!x)return r.error(new it(et.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!L)return r.error(new it(et.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!x)return r.error(new it(et.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||L.hidden||x.hidden)return null;let V;i.value===Kt.Strict?V=L.handleBounds.source:V=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const Q=iu(V,h.value.sourceHandle);let me;i.value===Kt.Strict?me=x.handleBounds.target:me=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const ve=iu(me,h.value.targetHandle),Ee=(Q==null?void 0:Q.position)||Re.Bottom,$e=(ve==null?void 0:ve.position)||Re.Top,{x:Me,y:Ue}=oo(L,Q,Ee),{x:Ye,y:Fe}=oo(x,ve,$e);return h.value.sourceX=Me,h.value.sourceY=Ue,h.value.targetX=Ye,h.value.targetY=Fe,n.h("g",{ref:ae,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ie.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:K.value,selected:h.value.selected,animated:h.value.animated,inactive:!E.value&&!N.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":S.value?`${Od}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...h.value.domAttributes,onClick:pe,onContextmenu:be,onDblclick:xe,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onKeyDown:S.value?j:void 0},[v.value?null:n.h(ie.value===!1?c.value.default:ie.value,{id:e.id,sourceNode:L,targetNode:x,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...P},style:ee.value,markerStart:`url('#${Ko(h.value.markerStart,t)}')`,markerEnd:`url('#${Ko(h.value.markerEnd,t)}')`,sourcePosition:Ee,targetPosition:$e,sourceX:Me,sourceY:Ue,targetX:Ye,targetY:Fe,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...R}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:ke,onMouseenter:U,onMouseout:ne},n.h(Au,{position:Ee,centerX:Me,centerY:Ue,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:we,onMouseenter:U,onMouseout:ne},n.h(Au,{position:$e,centerX:Ye,centerY:Fe,radius:a.value,type:"target","data-type":"target"}))]:null]])};function U(){K.value=!0}function ne(){K.value=!1}function ce(L,x){k.update({event:L,edge:h.value,connection:x})}function ge(L){k.updateEnd({event:L,edge:h.value}),v.value=!1}function se(L,x){L.button===0&&(v.value=!0,T.value=x?h.value.target:h.value.source,H.value=(x?h.value.targetHandle:h.value.sourceHandle)??null,C.value=x?"target":"source",k.updateStart({event:L,edge:h.value}),O(L))}function pe(L){var x;const R={event:L,edge:h.value};E.value&&(l.value=!1,h.value.selected&&p.value?(d([h.value]),(x=ae.value)==null||x.blur()):o([h.value])),k.click(R)}function be(L){k.contextMenu({event:L,edge:h.value})}function xe(L){k.doubleClick({event:L,edge:h.value})}function Te(L){k.mouseEnter({event:L,edge:h.value})}function Ae(L){k.mouseMove({event:L,edge:h.value})}function fe(L){k.mouseLeave({event:L,edge:h.value})}function ke(L){se(L,!0)}function we(L){se(L,!1)}function j(L){var x;!y.value&&Ld.includes(L.key)&&E.value&&(L.key==="Escape"?((x=ae.value)==null||x.blur(),d([u(e.id)])):o([u(e.id)]))}}}),K0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=He(),f=(e=n.inject(aa))==null?void 0:e["connection-line"],p=n.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=n.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=n.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=n.computed(()=>c.value.markerStart?`url(#${Ko(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${Ko(c.value.markerEnd,t)})`:"");return()=>{var N,h,k;if(!p.value||!i.value)return null;const P=i.value.id,A=i.value.type,G=p.value.handleBounds;let K=(G==null?void 0:G[A])??[];if(o.value===Kt.Loose){const ee=(G==null?void 0:G[A==="source"?"target":"source"])??[];K=[...K,...ee]}if(!K)return null;const v=(P?K.find(ee=>ee.id===P):K[0])??null,T=(v==null?void 0:v.position)??Re.Top,{x:H,y:C}=oo(p.value,v,T);let ae=null;y.value&&(o.value===Kt.Strict?ae=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null:ae=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null);const E=((k=a.value)==null?void 0:k.position)??(T?Wr[T]:null);if(!T||!E)return null;const Y=l.value??c.value.type??Nn.Bezier;let S="";const W={sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E};return Y===Nn.Bezier?[S]=xu(W):Y===Nn.Step?[S]=Qr({...W,borderRadius:0}):Y===Nn.SmoothStep?[S]=Qr(W):Y===Nn.SimpleBezier?[S]=Cu(W):S=`M${H},${C} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},f?n.h(f,{sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:v,targetNode:y.value,targetHandle:ae,markerEnd:b.value,markerStart:_.value,connectionStatus:d.value}):n.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":_.value})))}}}),Y0=["id","markerWidth","markerHeight","markerUnits","orient"],W0={name:"MarkerType",compatConfig:{MODE:3}},q0=n.defineComponent({...W0,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Pr).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Pr).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,Y0))}}),X0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},J0={name:"MarkerDefinitions",compatConfig:{MODE:3}},Z0=n.defineComponent({...J0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=He(),r=n.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ko(d,t);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(n.openBlock(),n.createElementBlock("svg",X0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,c=>(n.openBlock(),n.createBlock(q0,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Q0={name:"Edges",compatConfig:{MODE:3}},ek=n.defineComponent({...Q0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Z0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),l=>(n.openBlock(),n.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(x1)(l,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(j0),{id:l.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(K0))],64))}}),tk=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:f,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:b,nodeDragThreshold:N,nodesDraggable:h,elementsSelectable:k,nodesConnectable:P,nodesFocusable:A,hooks:G}=He(),K=n.ref(null);n.provide(yu,K),n.provide(hu,e.id);const v=n.inject(aa),T=n.getCurrentInstance(),H=ku(),{node:C,parentNode:ae}=_u(e.id),{emit:E,on:Y}=G1(C,l),S=n.toRef(()=>typeof C.draggable>"u"?h.value:C.draggable),W=n.toRef(()=>typeof C.selectable>"u"?k.value:C.selectable),ee=n.toRef(()=>typeof C.connectable>"u"?P.value:C.connectable),ie=n.toRef(()=>typeof C.focusable>"u"?A.value:C.focusable),O=n.computed(()=>W.value||S.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),U=n.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),ne=n.computed(()=>{const x=C.type||"default",R=v==null?void 0:v[`node-${x}`];if(R)return R;let V=C.template||m.value[x];if(typeof V=="string"&&T){const Q=Object.keys(T.appContext.components);Q&&Q.includes(x)&&(V=n.resolveComponent(x,!1))}return V&&typeof V!="string"?V:(l.error(new it(et.NODE_TYPE_MISSING,V)),!1)}),ce=gu({id:e.id,el:K,disabled:()=>!S.value,selectable:W,dragHandle:()=>C.dragHandle,onStart(x){E.dragStart(x)},onDrag(x){E.drag(x)},onStop(x){E.dragStop(x)},onClick(x){j(x)}}),ge=n.computed(()=>C.class instanceof Function?C.class(C):C.class),se=n.computed(()=>{const x=(C.style instanceof Function?C.style(C):C.style)||{},R=C.width instanceof Function?C.width(C):C.width,V=C.height instanceof Function?C.height(C):C.height;return!x.width&&R&&(x.width=typeof R=="string"?R:`${R}px`),!x.height&&V&&(x.height=typeof V=="string"?V:`${V}px`),x}),pe=n.toRef(()=>Number(C.zIndex??se.value.zIndex??0));return u(x=>{(x.includes(e.id)||!x.length)&&xe()}),n.onMounted(()=>{n.watch(()=>C.hidden,(x=!1,R,V)=>{!x&&K.value&&(e.resizeObserver.observe(K.value),V(()=>{K.value&&e.resizeObserver.unobserve(K.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])})}),n.watch([()=>C.position.x,()=>C.position.y,()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.z},pe,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.width}],([x,R,V,Q,me,ve])=>{const Ee={x,y:R,z:ve+(p.value&&C.selected?1e3:0)};typeof V<"u"&&typeof Q<"u"?C.computedPosition=_1({x:V,y:Q,z:me},Ee):C.computedPosition=Ee},{flush:"post",immediate:!0}),n.watch([()=>C.extent,f],([x,R],[V,Q])=>{(x!==V||R!==Q)&&be()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?gr(()=>U).toBe(!0).then(be):be(),()=>C.hidden?null:n.h("div",{ref:K,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${ne.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:C.selected,selectable:W.value,parent:C.isParent},ge.value],style:{visibility:U.value?"visible":"hidden",zIndex:C.computedPosition.z??pe.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:O.value?"all":"none",...se.value},tabIndex:ie.value?0:void 0,role:ie.value?"group":void 0,"aria-describedby":y.value?void 0:`${Dd}-${t}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onContextmenu:ke,onClick:j,onDblclick:we,onKeydown:L},[n.h(ne.value===!1?m.value.default:ne.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...Y},selected:C.selected,resizing:C.resizing,dragging:ce.value,connectable:ee.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??pe.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:xe})]);function be(){const x=C.computedPosition,{computedPosition:R,position:V}=jr(C,_.value?ia(x,b.value):x,l.error,f.value,ae.value);(C.computedPosition.x!==R.x||C.computedPosition.y!==R.y)&&(C.computedPosition={...C.computedPosition,...R}),(C.position.x!==V.x||C.position.y!==V.y)&&(C.position=V)}function xe(){K.value&&d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])}function Te(x){ce!=null&&ce.value||E.mouseEnter({event:x,node:C})}function Ae(x){ce!=null&&ce.value||E.mouseMove({event:x,node:C})}function fe(x){ce!=null&&ce.value||E.mouseLeave({event:x,node:C})}function ke(x){return E.contextMenu({event:x,node:C})}function we(x){return E.doubleClick({event:x,node:C})}function j(x){W.value&&(!i.value||!S.value||N.value>0)&&qr(C,r.value,c,s,a,!1,K.value),E.click({event:x,node:C})}function L(x){if(!(zr(x)||y.value))if(Ld.includes(x.key)&&W.value){const R=x.key==="Escape";qr(C,r.value,c,s,a,R,K.value)}else S.value&&C.selected&&to[x.key]&&(x.preventDefault(),g.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,H({x:to[x.key].x,y:to[x.key].y},x.shiftKey))}}});function nk(e={includeHiddenNodes:!1}){const{nodes:t}=He();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const ok={class:"vue-flow__nodes vue-flow__container"},ik={name:"Nodes",compatConfig:{MODE:3}},ak=n.defineComponent({...ik,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=He(),a=nk(),r=n.ref();return n.watch(a,l=>{l&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(n.openBlock(),n.createElementBlock("div",ok,[r.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,m)=>{const f=[c.id];if(m&&m.key===c.id&&n.isMemoSame(m,f))return m;const p=(n.openBlock(),n.createBlock(n.unref(tk),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=f,p},s,0),128)):n.createCommentVNode("",!0)]))}});function rk(){const{emits:e}=He();n.onMounted(()=>{if(cu()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new it(et.MISSING_STYLES))}})}const lk=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),sk={name:"VueFlow",compatConfig:{MODE:3}},ck=n.defineComponent({...sk,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const i=e,a=n.useSlots(),r=br(i,"modelValue",o),l=br(i,"nodes",o),s=br(i,"edges",o),c=He(i),d=W1({modelValue:r,nodes:l,edges:s},i,c);return X1(o,c.hooks),F0(),rk(),n.provide(aa,a),n.onUnmounted(d),t(c),(u,m)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(D0,null,{default:n.withCtx(()=>[n.createVNode(ek),lk,n.createVNode(ak),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(U0)],512))}}),dk={name:"Panel",compatConfig:{MODE:3}},Tu=n.defineComponent({...dk,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=He(),i=n.computed(()=>`${t.position}`.split("-"));return(a,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),Sn=["red","amber","green","teal","blue","indigo","violet","pink"],Vu={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function uk(e){return typeof e=="string"&&e in Vu}const mk={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},fk=.15;function pk(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function hk(e){if(typeof e!="string")return null;const t=pk(e);if(!t||t.s<fk)return null;let o=null,i=1/0;for(const a of Sn){const r=Math.abs(t.h-mk[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function ut(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(uk(t))return t;const o=e==null?void 0:e.properties;return hk((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function tl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const yk={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},gk={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function Mu(e,t=!1){return e?t?gk[e]:yk[e]:null}function io(e){return Vu[e]}function ao(e){return`var(--em-swatch-${e}-bar)`}const bk=["width","height","innerHTML"],_k=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,bk))}}),Ge=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ge(_k,[["__scopeId","data-v-92c1dba8"]]);function kk(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function Ek(e,t){const o=kk(t);return o?e(o):t.split("-")[1]??t}function Nk(e){const t=o=>e.params!=null&&o in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return"em.check.name3";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return t("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return t("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";default:return e.ruleId}}function Bu(e,t){const o=Nk(t);if(t.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=t.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,t.params)}function wk(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const vk={class:"em-inline-issue__msgs"},$n=Ge(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o=t.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),r=n.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${r.value}`])},[n.createVNode(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",vk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,(c,d)=>(n.openBlock(),n.createElementBlock("span",{key:d},n.toDisplayString(n.unref(Bu)(n.unref(o).t,c)),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),xk={class:"em-mlang"},Ik={class:"em-mlang__tabs",role:"tablist"},Ck=["aria-selected","onClick"],Sk={key:0,class:"em-mlang__dot"},Rn=Ge(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const r=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(r.value)||(r.value=a())});function l(d){var u,m;return!!((m=(u=o.modelValue)==null?void 0:u[d])!=null&&m.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[r.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[r.value]:u[r.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",xk,[n.createElementVNode("div",Ik,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,m=>(n.openBlock(),n.createElementBlock("button",{key:m,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":r.value===m}]),role:"tab","aria-selected":r.value===m,onClick:f=>r.value=m},[n.createTextVNode(n.toDisplayString(m),1),l(m)?(n.openBlock(),n.createElementBlock("span",Sk,"•")):n.createCommentVNode("",!0)],10,Ck))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(oe.BSTextArea),{key:0,name:`${e.name}-${r.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`${e.name}-${r.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),$k=["disabled"],Rk={class:"em-panel__sub-label"},Ak={class:"em-field"},Tk={class:"em-field"},Vk={class:"em-field"},Mk={class:"em-class"},Bk={class:"em-field"},Dk={class:"em-field"},Ok={class:"em-field"},Lk={class:"em-field"},Pk={class:"em-multilang"},zk={class:"em-multilang"},Uk={class:"em-jpa"},Fk={class:"em-field"},Hk={class:"em-field"},Gk={class:"em-field"},jk={class:"em-swatch"},Kk={class:"em-swatch__row"},Yk=["title"],Wk=["title","onClick"],Du=Ge(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=n.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=n.computed(()=>{var C;return ut(((C=l.value)==null?void 0:C.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=C=>C;function f(C){return C==="inherit"?a.t("em.common.inherit"):C}function p(C){r.value&&a.updateEntity(r.value.modelId,C)}function y(C,ae,E){var S;const Y=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(C==="physicalName"?{table:{...Y,physicalName:E}}:{table:{...Y,logicalName:{...Y.logicalName,[ae]:E}}})}function g(C){p({description:Object.keys(C).length?C:void 0})}function _(C,ae){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[C]:ae}})}function b(C,ae){_(C,ae)}const N=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:ae.discriminatorType)??"inherit"}),h=n.computed(()=>{var C,ae;return!((ae=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&ae.useDiscriminator)});function k(C){_("discriminatorType",C==="inherit"?void 0:C)}function P(C){p({hasPersonalInfo:C})}function A(C){p({superClass:C.trim()||void 0})}function G(C){p({schema:C.trim()||void 0})}function K(C){p({abstractClass:C})}const v=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:ae.join(", "))??""});function T(C){const ae=C.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:ae.length?ae:void 0})}function H(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,ae)=>{var E,Y,S;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:ae[0]||(ae[0]=W=>i("toggle"))},[n.createElementVNode("span",Rk,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||r.value.name||n.unref(a).t("em.entity.fallback")),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode($n,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",Ak,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.name")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":ae[1]||(ae[1]=W=>p({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",Tk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.stereotype")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":ae[2]||(ae[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",Vk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":ae[3]||(ae[3]=W=>p({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",Mk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.classLegend")),1),n.createElementVNode("label",Bk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.superClass")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:n.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":ae[4]||(ae[4]=W=>A(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("label",Dk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.interfaces")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:n.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":v.value,"onUpdate:modelValue":ae[5]||(ae[5]=W=>T(W))},null,8,["placeholder","model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-abstract",class:"em-check",label:n.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":ae[6]||(ae[6]=W=>K(W))},null,8,["label","model-value"])]),n.createElementVNode("label",Ok,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.tablePhysical")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":ae[7]||(ae[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",Lk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.schema")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-schema",width:"100%",placeholder:n.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":ae[8]||(ae[8]=W=>G(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("fieldset",Pk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.tableLogicalLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var ee,ie;return n.openBlock(),n.createElementBlock("label",{key:W,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(W),1),n.createVNode(n.unref(oe.BSTextInput),{name:`ent-logical-${W}`,width:"100%","model-value":((ie=(ee=r.value.table)==null?void 0:ee.logicalName)==null?void 0:ie[W])??"","onUpdate:modelValue":O=>y("logicalName",W,O)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",zk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",Uk,[ae[13]||(ae[13]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var ee;return n.createVNode(n.unref(oe.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((ee=r.value.jpaAttrs)!=null&&ee[W.key]),"onUpdate:modelValue":ie=>b(W.key,ie)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",Fk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discColumn")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"disc-col",width:"100%",placeholder:n.unref(a).t("em.entity.discColumnPlaceholder"),disabled:h.value,"model-value":((Y=r.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":ae[9]||(ae[9]=W=>_("discriminatorColumnName",W.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),n.createElementVNode("label",Hk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discType")),1),n.createVNode(n.unref(oe.BSSelect),{disabled:h.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":ae[10]||(ae[10]=W=>W&&k(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Gk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discLength")),1),n.createVNode(n.unref(oe.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":ae[11]||(ae[11]=W=>_("discriminatorLength",W||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:n.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":P},null,8,["label","model-value"]),n.createElementVNode("fieldset",jk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.headerColor")),1),n.createElementVNode("div",Kk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:ae[12]||(ae[12]=W=>H(null))},"∅",10,Yk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(ao)(W)}),title:n.unref(io)(W),onClick:ee=>H(W)},null,14,Wk))),128))])])],64)):n.createCommentVNode("",!0)],8,$k)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-92e146f7"]]),Ou={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.descPlaceholderKo":"Description (ko)","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3":'Duplicate entity name: "{name}"',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.unspecified":"unspecified"},Lu={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.descPlaceholderKo":"説明(ko)","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3":'エンティティ名が重複しています: "{name}"',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.unspecified":"未指定"},Pu={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.descPlaceholderKo":"설명(ko)","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3":'엔티티 이름이 중복됩니다: "{name}"',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.unspecified":"미지정"},qk=["ko","en","ja"],nl={ko:Pu,en:Ou,ja:Lu};function Ct(e,t,o){let a=(nl[e]??nl.ko)[t]??nl.ko[t]??t;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const zu=["ko","en","ja","zh"];function Xk(e){if(e)for(const t of zu){const o=e[t];if(o)return o}}function ol(e){const t=Xk(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function Jk(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:zu.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Zk=["aria-expanded","placeholder"],Qk=["aria-selected","onClick","onMouseenter"],eE={key:0,class:"gcc__opt gcc__opt--empty"},Uu=Ge(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=(v,T)=>Ct(o.locale??"ko",v,T),r=n.ref(),l=n.ref(),s=n.ref(),c=n.ref(""),d=n.ref(!1),u=n.ref(-1),m=n.ref({}),f=n.computed(()=>o.items.find(v=>v.groupCode===o.modelValue)),p=n.computed(()=>f.value?ol(f.value):"");n.watch(p,v=>{d.value||(c.value=v)},{immediate:!0});const y=n.computed(()=>c.value===p.value?o.items:Jk(o.items,c.value));function g(){var T;const v=(T=r.value)==null?void 0:T.getBoundingClientRect();v&&(m.value={left:`${v.left}px`,top:`${v.bottom}px`,width:`${v.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(v=>v.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",K)}function b(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",K)}n.onBeforeUnmount(b);function N(){_(),n.nextTick(()=>{var v;return(v=l.value)==null?void 0:v.select()})}function h(){d.value||_(),u.value=0}function k(v){i("update:modelValue",v.groupCode),c.value=ol(v),b()}function P(){i("update:modelValue",void 0),c.value="",b()}function A(){c.value.trim()===""?P():(c.value=p.value,b())}function G(v){var T;if(v.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),v.preventDefault();else if(v.key==="ArrowUp")u.value=Math.max(u.value-1,0),v.preventDefault();else if(v.key==="Enter"){const H=y.value[u.value];H&&k(H),v.preventDefault()}else v.key==="Escape"&&(c.value=p.value,b(),(T=l.value)==null||T.blur())}function K(v){var H,C;const T=v.target;!((H=r.value)!=null&&H.contains(T))&&!((C=s.value)!=null&&C.contains(T))&&A()}return(v,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":T[0]||(T[0]=H=>c.value=H),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:h,onKeydown:G},null,40,Zk),[[n.vModelText,c.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[d.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:n.normalizeStyle(m.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:T[1]||(T[1]=n.withModifiers(()=>{},["prevent"])),onClick:P},n.toDisplayString(a("em.common.noneParen")),33),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:H.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":C===u.value,"is-selected":H.groupCode===e.modelValue}]),role:"option","aria-selected":H.groupCode===e.modelValue,onMousedown:T[2]||(T[2]=n.withModifiers(()=>{},["prevent"])),onClick:ae=>k(H),onMouseenter:ae=>u.value=C},n.toDisplayString(n.unref(ol)(H)),43,Qk))),128)),y.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",eE,n.toDisplayString(a("em.groupCode.noMatch")),1))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),tE=["disabled"],nE={class:"em-aw__toolbar"},oE={class:"em-aw__count"},iE={class:"em-aw__scroll"},aE={class:"em-aw__table"},rE={class:"c-name"},lE={class:"c-type"},sE={class:"c-logical"},cE={class:"c-col"},dE={class:"c-constraints"},uE={class:"c-del"},mE={class:"c-expand"},fE=["title","onClick","onKeydown"],pE={class:"c-constraints"},hE={class:"em-aw__cflags"},yE=["title"],gE={colspan:"8"},bE={class:"em-aw__detail"},_E={class:"em-aw__dgroup"},kE={class:"em-aw__df"},EE={class:"em-aw__df"},NE={class:"em-aw__df"},wE={class:"em-aw__dgroup"},vE={class:"em-aw__dgroup"},xE={class:"em-aw__df"},IE={key:0,class:"em-aw__df"},CE={class:"em-aw__df"},SE={class:"c-expand"},$E={class:"em-aw__caret is-static","aria-hidden":"true"},RE={class:"c-del"},AE={class:"c-expand"},TE=["title","onClick","onKeydown"],VE={class:"em-aw__embed-label"},ME={class:"em-aw__ro"},BE={class:"em-aw__ro"},DE={class:"c-constraints"},OE={class:"em-aw__ro"},LE={key:0,class:"em-aw__detail-row em-aw__embed-detail"},PE={colspan:"8"},zE={class:"em-aw__detail"},UE={class:"em-aw__dgroup"},FE={key:0,class:"em-aw__df"},HE={class:"em-aw__df"},GE={class:"em-aw__df"},jE={key:0},KE={colspan:"99",class:"em-aw__empty"},YE=6,WE=5,fa="__OWN__",qE=Ge(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(I=>I.modelId===t.entityId)??null),a=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),l=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(D=>D.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(I){return s.value.has(I)}function d(I){const D=new Set(s.value);D.has(I)?D.delete(I):D.add(I),s.value=D}const u=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function m(I){return I==="none"?o.t("em.common.noneParen"):I}const f=I=>I;function p(I,D){i.value&&o.updateAttribute(i.value.modelId,I.modelId,D)}function y(I){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,I.modelId)}function g(I,D){p(I,{naturalId:D||void 0,naturalIdMutable:D?I.naturalIdMutable:void 0})}function _(){return{naturalId:void 0,naturalIdMutable:void 0}}function b(I,D){p(I,{identifier:D,...D?_():{}})}function N(I,D){p(I,{transient:D||void 0,...D?_():{}})}function h(I){return!!I.transient}const k=I=>I.value,P=I=>I.label;function A(I,D){if(!D)return;const B=ae.value.find(de=>de.type===D);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};p(I,{type:D,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}p(I,D===Rt?{type:D}:{type:D,customType:void 0})}function G(I,D){p(I,{customType:D.trim()===""?void 0:D})}function K(I,D){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...D};D.dataType!==void 0&&!_o.has(de.dataType)&&(de.scale=void 0),p(I,{dbAttrs:[de]})}function v(I){var D;return _o.has(((D=I.dbAttrs[0])==null?void 0:D.dataType)??"")}function T(I,D){K(I,{logicalName:Object.keys(D).length?D:void 0})}function H(I){return I.personalInfoAttributeType??"none"}function C(I,D){p(I,{personalInfoAttributeType:D==="none"?void 0:D})}const ae=n.computed(()=>o.predefinedCustomTypeCatalog.value),E=n.computed(()=>o.embeddableCatalog.value);function Y(I){var D,B;return((D=I.label)==null?void 0:D.ko)??((B=I.label)==null?void 0:B.en)??I.type}function S(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function ee(I){var D;return((D=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:D.codes)??[]}function ie(I){return["none",...ee(I)]}function O(I){return I==="none"?"none":I.code}function U(I){var B,de;if(I==="none")return o.t("em.common.noneParen");const D=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return D?`${I.code} (${D})`:I.code}function ne(I,D){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,D)}function ce(I,D){p(I,{defaultValue:D==="none"?void 0:D})}function ge(I,D){p(I,{defaultValue:D.trim()===""?void 0:D})}function se(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function pe(I,D,B){const de=I.dbAttrs.map((J,X)=>{if(X!==D)return J;const te={...J,...B};for(const re of Object.keys(B))B[re]===void 0&&delete te[re];return te});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function be(I,D,B){pe(I,D,{logicalName:Object.keys(B).length?B:void 0})}function xe(I,D){var J,X,te;if(I.attrType==="EMBED_PREDEF"){const re=(J=o.embeddableCatalog.value.find(Ne=>Ne.type===I.type))==null?void 0:J.fields[D];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const B=(X=I.embedded)==null?void 0:X.embeddableRef;if(!B)return;const de=(te=o.state.logical.entities.find(re=>re.modelId===B))==null?void 0:te.attributes.flatMap(re=>re.dbAttrs)[D];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function Te(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.dataType)||((de=I.dbAttrs[D])==null?void 0:de.dataType)||""}function Ae(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.length)??((de=I.dbAttrs[D])==null?void 0:de.length)}function fe(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.scale)??((de=I.dbAttrs[D])==null?void 0:de.scale)}const ke=["inherit","true","false"];function we(I){return I==="inherit"?o.t("em.common.inherit"):I}function j(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function L(I,D,B){pe(I,D,{updatable:B==="inherit"?void 0:B==="true"})}function x(I,D){K(I,{updatable:D==="inherit"?void 0:D==="true"})}const R=["inherit","true","false"];function V(I){return I==="inherit"?o.t("em.common.inherit"):I}function Q(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function me(I,D,B){pe(I,D,{insertable:B==="inherit"?void 0:B==="true"})}function ve(I,D){K(I,{insertable:D==="inherit"?void 0:D==="true"})}const Ee=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),$e=n.computed(()=>mn(Ee.value.flatMap(I=>I.attributes.flatMap(D=>D.dbAttrs)))),Me=n.computed(()=>Ee.value.flatMap(I=>I.attributes.filter(D=>D.attrType==="NORMAL"&&D.dbAttrs.length===1&&D.dbAttrs[0]).map(D=>{var B;return{modelId:D.dbAttrs[0].modelId,physical:D.dbAttrs[0].physicalName||D.name,isCurrency:D.type==="Currency",ownerName:I.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:I.name}})));function Ue(){const I=[...Me.value].sort((D,B)=>Number(B.isCurrency)-Number(D.isCurrency));return[fa,...I.map(D=>D.modelId)]}function Ye(I){if(I===fa)return o.t("em.attr.sharedOwn");const D=Me.value.find(de=>de.modelId===I);if(!D)return I;const B=D.ownerName?`${D.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:B,physical:D.physical,mode:D.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function Fe(I){return(I==null?void 0:I.sharedColumnRef)??fa}function gt(I,D,B){pe(I,D,{sharedColumnRef:B===fa?void 0:B})}function w(I){return(I==null?void 0:I.sharedColumnRef)!=null}function M(I){var D;return((D=zn(I,$e.value))==null?void 0:D.physicalName)??""}return(I,D)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",nE,[n.createElementVNode("span",oE,n.toDisplayString(n.unref(o).t("em.attr.section",{n:l.value})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:D[0]||(D[0]=B=>n.unref(o).addAttribute(i.value.modelId))},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.attr.addDivider"),onClick:D[1]||(D[1]=B=>n.unref(o).addDivider(i.value.modelId))},null,8,["caption"]),E.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"140px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:E.value,"value-provider":B=>B.type,"label-provider":Y,"onUpdate:modelValue":S},null,8,["placeholder","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",iE,[n.createElementVNode("table",aE,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[D[2]||(D[2]=n.createElementVNode("th",{class:"c-expand"},null,-1)),n.createElementVNode("th",rE,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),n.createElementVNode("th",lE,n.toDisplayString(n.unref(o).t("em.attr.typePlaceholder")),1),n.createElementVNode("th",sE,n.toDisplayString(n.unref(o).t("em.attr.logicalPlaceholder")),1),n.createElementVNode("th",cE,n.toDisplayString(n.unref(o).t("em.attr.columnPhysical")),1),D[3]||(D[3]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),D[4]||(D[4]=n.createElementVNode("th",{class:"c-len"},"len",-1)),n.createElementVNode("th",dE,n.toDisplayString(n.unref(o).t("em.attr.constraints")),1),D[5]||(D[5]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,J,X,te,re,Ne,$,Z,F,Ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":r.value.has(B.modelId)}])},[D[6]||(D[6]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:YE,class:"em-aw__divider-note"},n.toDisplayString(n.unref(o).t("em.attr.dividerNote")),1),n.createElementVNode("td",uE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):se(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":r.value.has(B.modelId)}])},[n.createElementVNode("td",SE,[n.createElementVNode("span",$E,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:WE,class:"em-aw__embed-note"},n.toDisplayString(n.unref(o).t("em.attr.embedChildCols",{n:B.dbAttrs.length})),1),n.createElementVNode("td",RE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ye,ze)=>{var z,q,ue,Ce,Be,Oe;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ye.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(ye.modelId)}])},[n.createElementVNode("td",AE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(ye.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(ye.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:he=>d(ye.modelId),onKeydown:[n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,TE)]),n.createElementVNode("td",VE,"↳ "+n.toDisplayString(((z=xe(B,ze))==null?void 0:z.name)??((q=xe(B,ze))==null?void 0:q.physicalName)??n.unref(o).t("em.attr.colFallback",{n:ze+1})),1),D[13]||(D[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-embed-logical-${ye.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((Ce=(ue=xe(B,ze))==null?void 0:ue.logicalName)==null?void 0:Ce.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ye.logicalName,"onUpdate:modelValue":he=>be(B,ze,he)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-embed-col-${ye.modelId}`,width:"100%",disabled:w(ye),placeholder:((Be=xe(B,ze))==null?void 0:Be.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":w(ye)?M(ye):ye.physicalName,"onUpdate:modelValue":he=>pe(B,ze,{physicalName:he})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":ye.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",ME,n.toDisplayString(Te(B,ze)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",BE,n.toDisplayString(Ae(B,ze)??""),1)]),n.createElementVNode("td",DE,[n.createElementVNode("span",OE,n.toDisplayString(fe(B,ze)!=null?`scale ${fe(B,ze)}`:""),1)]),D[14]||(D[14]=n.createElementVNode("td",null,null,-1))],2),c(ye.modelId)?(n.openBlock(),n.createElementBlock("tr",LE,[D[17]||(D[17]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",PE,[n.createElementVNode("div",zE,[n.createElementVNode("fieldset",UE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.overrideLegend")),1),(Oe=xe(B,ze))!=null&&Oe.shareable?(n.openBlock(),n.createElementBlock("label",FE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":Fe(ye),items:Ue(),"value-provider":f,"label-provider":Ye,"onUpdate:modelValue":he=>he&&gt(B,ze,he)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",HE,[D[15]||(D[15]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":Q(ye),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":he=>he&&me(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",GE,[D[16]||(D[16]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":j(ye),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":he=>he&&L(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":r.value.has(B.modelId),"em-aw__open":c(B.modelId)})},[n.createElementVNode("td",mE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(B.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(B.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ye=>d(B.modelId),onKeydown:[n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,fE)]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:!!B.groupCode,items:n.unref(Ql)(B.type,ae.value),"value-provider":k,"label-provider":P,"model-value":B.type,"onUpdate:modelValue":ye=>A(B,ye)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(Rt)?(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":B.customType??"","onUpdate:modelValue":ye=>G(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-logical-${B.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(de=B.dbAttrs[0])==null?void 0:de.logicalName,"onUpdate:modelValue":ye=>T(B,ye)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:h(B),"model-value":((J=B.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ye=>K(B,{physicalName:ye})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":(X=B.dbAttrs[0])==null?void 0:X.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:h(B),items:n.unref(Jl)(((te=B.dbAttrs[0])==null?void 0:te.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":f,"label-provider":n.unref(qa),"model-value":((re=B.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ye=>ye&&K(B,{dataType:ye})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:h(B),"model-value":(Ne=B.dbAttrs[0])==null?void 0:Ne.length,"onUpdate:modelValue":ye=>K(B,{length:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",pE,[n.createElementVNode("div",hE,[n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-pk-${B.modelId}`,label:"PK","model-value":B.identifier,disabled:a.value||h(B),"onUpdate:modelValue":ye=>b(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nn-${B.modelId}`,label:"NN","model-value":B.notNull,disabled:h(B),"onUpdate:modelValue":ye=>p(B,{notNull:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-uq-${B.modelId}`,label:"UQ","model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{unique:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(B)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,yE)],2),c(B.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":r.value.has(B.modelId)}])},[D[12]||(D[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",gE,[n.createElementVNode("div",bE,[n.createElementVNode("fieldset",_E,[D[10]||(D[10]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",kE,[D[7]||(D[7]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"72px",placeholder:"scale",disabled:h(B)||!v(B),"model-value":(Z=B.dbAttrs[0])==null?void 0:Z.scale,"onUpdate:modelValue":ye=>K(B,{scale:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((F=B.dbAttrs[0])!=null&&F.autoIncrement),disabled:h(B)||!B.identifier,"onUpdate:modelValue":ye=>K(B,{autoIncrement:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",EE,[D[8]||(D[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-ins-${B.modelId}`,width:"110px",disabled:h(B),"model-value":Q(B.dbAttrs[0]),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":ye=>ye&&ve(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",NE,[D[9]||(D[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-upd-${B.modelId}`,width:"110px",disabled:h(B),"model-value":j(B.dbAttrs[0]),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":ye=>ye&&x(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",wE,[D[11]||(D[11]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ye=>N(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||h(B),"onUpdate:modelValue":ye=>g(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:h(B)||!B.naturalId,"onUpdate:modelValue":ye=>p(B,{naturalIdMutable:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ie=B.dbAttrs[0])!=null&&Ie.multiValue),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{multiValue:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",vE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.semanticLegend")),1),n.createElementVNode("label",xE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":H(B),items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":ye=>ye&&C(B,ye)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",IE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":B.groupCode,items:W.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":ye=>ne(B,ye)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",CE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),ee(B).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"150px","model-value":B.defaultValue??"none",items:ie(B),"value-provider":O,"label-provider":U,"onUpdate:modelValue":ye=>ye&&ce(B,ye)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"150px",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":B.defaultValue??"","onUpdate:modelValue":ye=>ge(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",jE,[n.createElementVNode("td",KE,n.toDisplayString(n.unref(o).t("em.attr.empty")),1)]))])])])],8,tE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-a64a6817"]]),XE=["disabled"],JE={class:"em-idxw__list"},ZE={class:"em-idxw__list-head"},QE=["onClick"],eN={class:"em-idxw__item-name"},tN={key:0,class:"em-idxw__badge"},nN={class:"em-idxw__item-cnt"},oN={key:0,class:"em-idxw__empty"},iN={key:0,class:"em-idxw__edit"},aN={class:"em-idxw__form"},rN={class:"em-field em-idxw__name"},lN={class:"em-field"},sN=["value","placeholder"],cN={class:"em-idxw__transfer"},dN={class:"em-idxw__pane"},uN={class:"em-idxw__pane-head"},mN={class:"em-idxw__cols"},fN=["onClick"],pN=["title"],hN={key:0,class:"em-idxw__empty"},yN={class:"em-idxw__arrows"},gN={class:"em-idxw__pane"},bN={class:"em-idxw__pane-head"},_N={class:"em-idxw__cols"},kN={class:"em-idxw__col-name"},EN=["title"],NN={class:"em-idxw__col-ops"},wN=["title","disabled","onClick"],vN=["title","disabled","onClick"],xN=["title","onClick"],IN={key:0,class:"em-idxw__empty"},CN={key:1,class:"em-idxw__edit em-idxw__edit--empty"},SN=Ge(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(v=>v.modelId===t.entityId)??null),a=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.indexes)??[]}),r=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes)??[]}),l=n.ref(null);n.watch(a,v=>{var T;v.some(H=>H.modelId===l.value)||(l.value=((T=v[0])==null?void 0:T.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(v=>v.modelId===l.value)??null),c=n.computed(()=>i.value?go(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var v;return new Set(((v=s.value)==null?void 0:v.columns.map(T=>T.columnRef))??[])}),u=n.computed(()=>[...r.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:f(v),inherited:!1})),...c.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:p(v),inherited:!0}))]),m=n.ref(new Set);n.watch(l,()=>m.value=new Set);function f(v){var H;const T=(H=v.dbAttrs[0])==null?void 0:H.physicalName;return T&&T!==v.name?`${v.name} (${T})`:v.name}function p(v){return v.physicalName&&v.physicalName!==v.field?`${v.field} (${v.physicalName})`:v.field}function y(v){const T=r.value.find(C=>C.modelId===v);if(T)return f(T);const H=c.value.find(C=>C.modelId===v);return H?p(H):v}function g(v){return yo(v)}function _(v,T){i.value&&o.updateIndex(i.value.modelId,v,T)}function b(){var T;if(!i.value)return;const v=De();o.addIndex(i.value.modelId,{modelId:v,name:`idx_${(((T=i.value.indexes)==null?void 0:T.length)??0)+1}`,unique:!1,columns:[]}),l.value=v}function N(v){i.value&&o.removeIndex(i.value.modelId,v)}function h(v){s.value&&_(s.value.modelId,{parameters:v.trim()===""?void 0:v})}function k(v){const T=new Set(m.value);T.has(v)?T.delete(v):T.add(v),m.value=T}function P(){const v=s.value;if(!v||!m.value.size)return;const T=[...m.value].map(H=>({columnRef:H,descending:!1}));_(v.modelId,{columns:[...v.columns,...T]}),m.value=new Set}function A(v){const T=s.value;T&&_(T.modelId,{columns:T.columns.filter((H,C)=>C!==v)})}function G(v,T){const H=s.value;H&&_(H.modelId,{columns:H.columns.map((C,ae)=>ae===v?{...C,descending:T}:C)})}function K(v,T){const H=s.value;if(!H)return;const C=v+T;if(C<0||C>=H.columns.length)return;const ae=[...H.columns];[ae[v],ae[C]]=[ae[C],ae[v]],_(H.modelId,{columns:ae})}return(v,T)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",JE,[n.createElementVNode("div",ZE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.section",{n:a.value.length})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:b},null,8,["caption"])]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":H.modelId===l.value}]),onClick:C=>l.value=H.modelId},[n.createElementVNode("span",eN,n.toDisplayString(H.name||n.unref(o).t("em.attr.nameless")),1),H.unique?(n.openBlock(),n.createElementBlock("span",tN,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",nN,n.toDisplayString(H.columns.length),1)],10,QE))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",oN,n.toDisplayString(n.unref(o).t("em.index.empty")),1))])]),s.value?(n.openBlock(),n.createElementBlock("section",iN,[n.createElementVNode("div",aN,[n.createElementVNode("label",rN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.namePlaceholder")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":T[0]||(T[0]=H=>_(s.value.modelId,{name:H}))},null,8,["model-value"]),n.createVNode($n,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":T[1]||(T[1]=H=>_(s.value.modelId,{unique:H}))},null,8,["model-value"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:n.unref(o).t("em.index.delete"),onClick:T[2]||(T[2]=H=>N(s.value.modelId))},null,8,["caption"])]),n.createElementVNode("label",lN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:n.unref(o).t("em.index.conditionPlaceholderWide"),onChange:T[3]||(T[3]=H=>h(H.target.value))},null,40,sN)]),n.createElementVNode("div",cN,[n.createElementVNode("div",dN,[n.createElementVNode("div",uN,n.toDisplayString(n.unref(o).t("em.index.availColumns",{n:u.value.length})),1),n.createElementVNode("ul",mN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":m.value.has(H.ref)}]),onClick:C=>k(H.ref)},[n.createTextVNode(n.toDisplayString(H.label),1),H.inherited?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,pN)):n.createCommentVNode("",!0)],10,fN))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",hN,n.toDisplayString(n.unref(o).t("em.index.allColumnsUsed")),1))])]),n.createElementVNode("div",yN,[n.createVNode(n.unref(oe.BSButton),{caption:n.unref(o).t("em.index.addArrow"),disabled:!m.value.size,onClick:P},null,8,["caption","disabled"])]),n.createElementVNode("div",gN,[n.createElementVNode("div",bN,n.toDisplayString(n.unref(o).t("em.index.indexColumns",{n:s.value.columns.length})),1),n.createElementVNode("ul",_N,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",kN,[n.createTextVNode(n.toDisplayString(y(H.columnRef)),1),g(H.columnRef)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,EN)):n.createCommentVNode("",!0)]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":H.descending,"onUpdate:modelValue":ae=>G(C,ae)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",NN,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:ae=>K(C,-1)},"↑",8,wN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveDown"),disabled:C===s.value.columns.length-1,onClick:ae=>K(C,1)},"↓",8,vN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:n.unref(o).t("em.index.removeColumn"),onClick:ae=>A(C)},"✕",8,xN)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",IN,n.toDisplayString(n.unref(o).t("em.index.noColumns")),1))])])])])):(n.openBlock(),n.createElementBlock("section",CN,n.toDisplayString(n.unref(o).t("em.index.selectPrompt")),1))],8,XE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-76de4c26"]]),$N={class:"em-op-src"},RN=["placeholder"],AN={class:"em-op-src__actions"},Fu=Ge(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(l,s)=>Ct(t.locale??"ko",l,s),a=n.ref(t.sourceCode);function r(){t.onSave(a.value),o.close()}return(l,s)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.opSource.title",{name:t.operationName})},{default:n.withCtx(()=>[n.createElementVNode("div",$N,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,RN),[[n.vModelText,a.value]]),n.createElementVNode("div",AN,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),TN=["disabled"],VN={class:"em-ow__toolbar"},MN={class:"em-ow__count"},BN={class:"em-ow__scroll"},DN={class:"em-ow__table"},ON={class:"c-name"},LN={class:"c-desc"},PN={class:"c-pii"},zN={class:"c-src"},UN={class:"c-del"},FN={key:0},HN={colspan:"6",class:"em-ow__empty"},GN=Ge(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModal(),a=n.computed(()=>o.state.logical.entities.find(y=>y.modelId===t.entityId)??null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],l=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(y){return y==="none"?o.t("em.common.noneParen"):y}const c=y=>y;function d(y,g){a.value&&o.updateOperation(a.value.modelId,y.modelId,g)}function u(y,g,_){d(y,{description:{...y.description,[g]:_}})}function m(y){return y.personalInfoAttributeType??"none"}function f(y,g){d(y,{personalInfoAttributeType:g==="none"?void 0:g})}function p(y){i.openModal({component:Fu,bind:{operationName:y.name,sourceCode:y.sourceCode??"",locale:o.uiLocale.value,onSave:g=>d(y,{sourceCode:g})}})}return(y,g)=>{var _,b;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",VN,[n.createElementVNode("span",MN,n.toDisplayString(n.unref(o).t("em.op.section",{n:((_=a.value.operations)==null?void 0:_.length)??0})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>n.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),n.createElementVNode("div",BN,[n.createElementVNode("table",DN,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",ON,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),g[1]||(g[1]=n.createElementVNode("th",{class:"c-vis"},"visibility",-1)),n.createElementVNode("th",LN,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createElementVNode("th",PN,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createElementVNode("th",zN,n.toDisplayString(n.unref(o).t("em.op.body")),1),g[2]||(g[2]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":k=>d(N,{name:k})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:r,"value-provider":c,"label-provider":c,"onUpdate:modelValue":k=>k&&d(N,{visibility:k})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.descPlaceholderKo"),"model-value":((h=N.description)==null?void 0:h.ko)??"","onUpdate:modelValue":k=>u(N,"ko",k)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":m(N),items:l,"value-provider":c,"label-provider":s,"onUpdate:modelValue":k=>k&&f(N,k)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:k=>p(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",UN,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:k=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(b=a.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",FN,[n.createElementVNode("td",HN,n.toDisplayString(n.unref(o).t("em.op.empty")),1)]))])])])],8,TN)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1c255914"]]),jN={class:"em-detail__tabs"},KN=["onClick"],YN={key:0,class:"em-detail__narrow"},WN=Ge(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const r=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],l=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:n.unref(o).t("em.detail.title",{name:((d=a.value)==null?void 0:d.name)??""})},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",jN,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(r,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":l.value===u.key}]),onClick:m=>l.value=u.key},n.toDisplayString(n.unref(o).t(u.labelKey)),11,KN)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[l.value==="basics"?(n.openBlock(),n.createElementBlock("div",YN,[n.createVNode(Du,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):l.value==="columns"?(n.openBlock(),n.createBlock(qE,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):l.value==="indexes"?(n.openBlock(),n.createBlock(SN,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(GN,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-785c4770"]]);function pa(e,t,o){e.openModal({component:WN,bind:{controller:n.markRaw(t),entityId:o}})}const Hu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function qN(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=De(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const r=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of t.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of t.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:t,idMap:o}}const XN=220;function JN(e,t){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||XN));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of t.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of t.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const il=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),An=Symbol("editorController");function Gu(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ha(e,t){const o=[];for(const i of t.remove)o.push(Wn(e,i));for(const i of t.update)o.push(gn(e,i.attributeId,i.patch));for(const i of t.add)o.push(Ut(e,i));return o}function ro(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function lo(e,t){const o=[];for(const[i,a]of fh(e,t,De))o.push(...ha(i,a));return o}function ju(e,t,o){const i=new Set(o.remove);return ro(e,t,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function al(e,t){const o=So(e,t,De),i=ha(t,o),a=ju(e,t,o);return i.push(...lo(a,t)),i}function Ku(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:De()}))}function ZN(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((p,y)=>Math.max(p,y.order),-1)+1,m=new Set(o.attributes.map(p=>p.name));let f="id";for(let p=2;m.has(f);p++)f=`id${p}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Ut(t,a))}const r=[];for(const u of e.entities)for(const m of u.attributes){if(((d=m.embedded)==null?void 0:d.embeddableRef)!==t)continue;const f=e.associations.find(_=>_.modelId===m.embedded.associationRef);if(!f)continue;const p=f.end1.entityRef===u.modelId,y=p?f.end1:f.end2,g=p?f.end2:f.end1;r.push({ownerId:u.modelId,dispId:m.modelId,assocId:f.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const m=new Set(r.filter(f=>f.ownerId===u.modelId).map(f=>f.dispId));return m.size?{...u,attributes:u.attributes.filter(f=>!m.has(f.modelId))}:u}),associations:e.associations.map(u=>{const m=r.find(f=>f.assocId===u.modelId);return m?{...u,end1:m.end1,end2:m.end2}:u})},s=So(l,t,De);for(const u of r){const m=s.add.find(f=>{var p;return((p=f.derivedFrom)==null?void 0:p.associationRef)===u.assocId});m&&(u.end2.attributeRef=m.modelId)}for(const u of r)i.push(Wn(u.ownerId,u.dispId)),i.push(Ii(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ha(t,s));const c=ju(l,t,s);return i.push(...lo(c,t)),i}function QN(e,t){const o=e.entities.find(r=>r.modelId===t);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===t,s=r.end2.entityRef===t;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var k;return((k=h.embedded)==null?void 0:k.associationRef)===r.modelId}))continue;const u=De(),m=d.attributes.reduce((h,k)=>Math.max(h,k.order),-1)+1,f=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;f.has(y);h++)y=`${p}${h}`;const g=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:t}};i.push(Ut(c,_));const b=l?"end2":"end1",N=l?"end1":"end2";i.push(Ii(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function ew(e=Gu(),t={}){var Fe,gt;const o=n.reactive(e);let i=new mr(o);const a=n.ref(t.embeddableCatalog??[]),r=n.ref(t.groupCodeCatalog??[]),l=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.uiLocale??"ko"),m=(w,M)=>Ct(u.value,w,M),f=n.ref(t.reservedWords),p=n.ref(t.selectableDataTypes),y=n.ref(t.largeEntityThreshold),g=n.ref(t.flagEntitiesWithoutRelations??!1),_=n.ref(!1),b=n.ref(!1),N=n.ref(!1),h=n.ref(0),k=n.ref(null);let P=0;const A=w=>{if(t.onNotice){t.onNotice(w);return}k.value={text:w,id:++P}},G=n.ref(((Fe=t.meta)==null?void 0:Fe.schemaVersion)??1),K=n.ref(((gt=t.meta)==null?void 0:gt.opWriteEnabled)??!1),v=n.computed(()=>G.value>=2&&K.value),T=t.historyTransport,H=n.computed(()=>v.value&&T!==void 0),C=t.restoreTransport,ae=n.ref(0),E=n.computed(()=>v.value&&S.value&&C!==void 0);async function Y(w){if(!C||!S.value)return{ok:!1,reason:"unavailable"};const M=await C(w);return M.ok&&ae.value++,M}const S=n.ref(!(G.value>=2&&K.value===!1)),W=n.ref("LOGICAL_PHYSICAL"),ee=n.ref("straight"),ie=n.ref(!0),O=n.ref(!0),U=n.ref(null),ne=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),ce=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?U.value.ids:[]}),ge=n.computed(()=>{var w,M;return((w=U.value)==null?void 0:w.kind)==="entity"?U.value.id:((M=U.value)==null?void 0:M.kind)==="attribute"?U.value.entityId:null}),se=n.ref(null);let pe=0;const be=n.ref(null),xe=n.ref(null);let Te=t.meta;function Ae(){i.onChange(()=>{_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,h.value++})}Ae();let fe=null,ke=null;function we(){ke==null||ke(),ke=null,fe=null}function j(){if(we(),!v.value||!t.opTransport)return;const w=new pc({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:M=>{S.value=!1,xe.value=M},onError:t.onOpError});w.seed((Te==null?void 0:Te.revSeed)??{}),ke=w.attach(i),fe=w}j();const L=n.computed(()=>Vl(o.logical,o.layout)),x=n.computed(()=>({reservedWords:f.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),R=n.computed(()=>ts(o.logical,x.value)),V=n.computed(()=>{const w=new Map;for(const M of R.value){if(!M.targetRef)continue;const I=w.get(M.targetRef);I?I.push(M):w.set(M.targetRef,[M])}return w}),Q=w=>{S.value&&i.execute(w)},me=w=>o.layout.entityLayouts.some(M=>M.entityRef===w&&!!M.locked),ve=w=>o.layout.groupLayouts.some(M=>M.groupRef===w&&!!M.locked),Ee=w=>{const M=o.logical.associations.find(I=>I.modelId===w);return!!M&&(me(M.end1.entityRef)||me(M.end2.entityRef))},$e=(w,M,I)=>{if(me(w))return;const D=gn(w,M,I),B=ro(o.logical,w,J=>J.map(X=>X.modelId===M?{...X,...I}:X)),de=lo(B,w);Q(de.length?Je("속성 수정",[D,...de]):D)};function Me(w){const M=w.map(te=>o.layout.entityLayouts.find(re=>re.entityRef===te)).filter(te=>!!te);if(!M.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,D=1/0,B=-1/0,de=-1/0;for(const te of M){const re=te.geo.size.width||220,Ne=te.geo.size.height||140;I=Math.min(I,te.geo.location.x),D=Math.min(D,te.geo.location.y),B=Math.max(B,te.geo.location.x+re),de=Math.max(de,te.geo.location.y+Ne)}const J=40,X=28;return{location:{x:I-J,y:D-J-X},size:{width:B-I+J*2,height:de-D+J*2+X}}}function Ue(w,M,I){var te;const D=o.layout.groupLayouts.find(re=>re.groupRef===w),B=(D==null?void 0:D.geo.location)??M,de=M.x-B.x,J=M.y-B.y,X=[Ds(w,M),...I.map(re=>Yn(re.id,re.location))];if(de||J){const re=new Set(((te=o.logical.groups.find(Ne=>Ne.modelId===w))==null?void 0:te.memberEntityRefs)??[]);for(const Ne of o.logical.associations){if(!re.has(Ne.end1.entityRef)||!re.has(Ne.end2.entityRef))continue;const $=o.layout.associationLayouts.find(Z=>Z.associationRef===Ne.modelId);$&&$.waypoints.length&&X.push(Js(Ne.modelId,de,J))}for(const Ne of(D==null?void 0:D.memberNoteRefs)??[]){const $=o.layout.notes.find(Z=>Z.modelId===Ne);$&&X.push(Co(Ne,{x:$.geo.location.x+de,y:$.geo.location.y+J}))}}return X}const Ye={state:o,resolved:L,issues:R,issuesByRef:V,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:b,dirty:N,revision:h,notice:k,editable:S,schemaVersion:G,opWriteEnabled:K,opMode:v,opConflict:xe,historyTransport:T,historyAvailable:H,restoreTransport:C,restoreAvailable:E,restoreToSeq:Y,reloadRequest:ae,displayMode:W,routingMode:ee,showGrid:ie,showMinimap:O,selection:U,selectedAttr:ne,selectedAttrIds:ce,inspectedEntityId:ge,focusRequest:se,clipboard:be,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(w){S.value=w&&v.value},setEmbeddableCatalog(w){a.value=w},setGroupCodeCatalog(w){r.value=w},setPredefinedCustomTypeCatalog(w){l.value=w},setSuperClassCatalog(w){s.value=w},selectAttribute(w,M,I="replace"){const D=U.value,B=(D==null?void 0:D.kind)==="attribute"&&D.entityId===w;if(I==="replace"||!B){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}if(I==="toggle"){const $=D.ids.includes(M),Z=$?D.ids.filter(Ie=>Ie!==M):[...D.ids,M];if(!Z.length){U.value=null;return}const F=$&&D.anchor===M?Z[Z.length-1]:$?D.anchor:M;U.value={kind:"attribute",entityId:w,ids:Z,anchor:F};return}const de=o.logical.entities.find($=>$.modelId===w),J=[...(de==null?void 0:de.attributes)??[]].sort(($,Z)=>$.order-Z.order).map($=>$.modelId),X=J.indexOf(D.anchor),te=J.indexOf(M);if(X<0||te<0){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}const[re,Ne]=X<=te?[X,te]:[te,X];U.value={kind:"attribute",entityId:w,ids:J.slice(re,Ne+1),anchor:D.anchor}},moveAttributeFocus(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find(J=>J.modelId===M.entityId);if(!I||!I.attributes.length)return!1;const D=I.attributes.findIndex(J=>J.modelId===M.anchor);if(D<0)return!1;const B=Math.min(Math.max(D+w,0),I.attributes.length-1);if(B===D)return!0;const de=I.attributes[B].modelId;return U.value={kind:"attribute",entityId:M.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find($=>$.modelId===M.entityId);if(!I)return!1;const D=I.attributes,B=new Set(M.ids),de=D.map(($,Z)=>B.has($.modelId)?Z:-1).filter($=>$>=0);if(!de.length)return!1;const J=Math.min(...de),X=D.filter($=>!B.has($.modelId)),te=D.slice(0,J).filter($=>!B.has($.modelId)).length;let re;if(w<0){if(te<=0)return!0;re=te-1}else{if(X.length-te<=0)return!0;re=te+1}if(me(M.entityId))return!0;const Ne=D.filter($=>B.has($.modelId)).map($=>$.modelId);return Q(pr(M.entityId,Ne,re)),!0},deleteSelection(){if(!S.value)return!1;const w=U.value;if(!w)return!1;if(w.kind==="attribute"){if(me(w.entityId))return!1;const M=w.ids;if(!M.length)return!1;M.length===1?Ye.removeAttribute(w.entityId,M[0]):Ye.removeAttributes(w.entityId,M)}else if(w.kind==="entity"){if(me(w.id))return!1;Ye.removeEntity(w.id)}else if(w.kind==="note")Ye.removeNote(w.id);else if(w.kind==="group"){if(ve(w.id))return!1;Ye.removeGroup(w.id)}else Ye.removeAssociation(w.id);return U.value=null,!0},nudgeNodes(w,M,I){if(!w.length||M===0&&I===0)return!1;const D=new Set(o.logical.entities.map(re=>re.modelId)),B=new Set(o.logical.groups.map(re=>re.modelId)),de=new Set(o.layout.notes.map(re=>re.modelId)),J=new Set;for(const re of w){if(!B.has(re))continue;const Ne=o.logical.groups.find($=>$.modelId===re);for(const $ of(Ne==null?void 0:Ne.memberEntityRefs)??[])J.add($)}const X=[],te=[];for(const re of w)if(B.has(re)){if(ve(re))continue;const Ne=o.layout.groupLayouts.find(Ie=>Ie.groupRef===re);if(!Ne)continue;const $=o.logical.groups.find(Ie=>Ie.modelId===re),Z=(($==null?void 0:$.memberEntityRefs)??[]).map(Ie=>{var ze;const ye=((ze=o.layout.entityLayouts.find(z=>z.entityRef===Ie))==null?void 0:ze.geo.location)??{x:0,y:0};return{id:Ie,location:{x:ye.x+M,y:ye.y+I}}}),F={x:Ne.geo.location.x+M,y:Ne.geo.location.y+I};X.push(Je("그룹 이동",Ue(re,F,Z))),te.push("g:"+re)}else if(D.has(re)){if(J.has(re)||me(re))continue;const Ne=o.layout.entityLayouts.find($=>$.entityRef===re);if(!Ne)continue;X.push(Yn(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("e:"+re)}else if(de.has(re)){const Ne=o.layout.notes.find($=>$.modelId===re);if(!Ne)continue;X.push(Co(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("n:"+re)}return X.length?(Q(Je("이동",X,"nudge:"+te.sort().join(","))),!0):!1},requestFocus(w){se.value={id:w,nonce:++pe}},undo:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(fe==null||fe.flush(),i.markSavePoint())},loadDiagram(w,M){we(),o.logical=w.logical,o.layout=w.layout,i=new mr(o),Ae(),G.value=(M==null?void 0:M.schemaVersion)??1,K.value=(M==null?void 0:M.opWriteEnabled)??!1,S.value=!(G.value>=2&&K.value===!1),Te=M,xe.value=null,U.value=null,_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,j()},flush(){fe==null||fe.flush()},whenOpsSettled(){return(fe==null?void 0:fe.whenSettled())??Promise.resolve()},addEntity(w="NewEntity",M={x:80,y:80}){const I=De(),D={modelId:I,name:w,stereotype:"JPA_ENTITY",table:{physicalName:w.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return Q(Ei(D,{location:{...M},size:{width:220,height:140}})),I},renameEntity(w,M){me(w)||Q(Ss(w,M))},updateEntity(w,M){if(me(w))return;const I=Cs(w,M),D=o.logical.entities.find(J=>J.modelId===w),B=M.stereotype==="JPA_EMBEDDABLE"&&!!D&&D.stereotype!=="JPA_EMBEDDABLE",de=!!M.stereotype&&M.stereotype!=="JPA_EMBEDDABLE"&&!!D&&D.stereotype==="JPA_EMBEDDABLE";if(B&&D){const J=D.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>gn(w,$.modelId,{identifier:!1})),X=ro({...o.logical,entities:o.logical.entities.map($=>$.modelId===w?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},w,$=>$.map(Z=>Z.identifier&&!Z.derivedFrom?{...Z,identifier:!1}:Z)),te=al(X,w),re=QN(o.logical,w),Ne=[I,...J,...te,...re];Q(Ne.length>1?Je("임베더블 변환",Ne):I);return}if(de){const J=ZN(o.logical,w),X=[I,...J];Q(X.length>1?Je("엔터티 전환",X):I);return}Q(I)},moveEntity(w,M){me(w)||Q(Yn(w,M))},resizeEntity(w,M){me(w)||Q($s(w,M))},removeEntity(w){me(w)||Q(Is(w))},setEntitySwatch(w,M){Q(Rs(w,M))},setEntityCollapsed(w,M){Q(As(w,M))},setEntityLocked(w,M){Q(Ts(w,M))},isEntityLocked(w){return me(w)},collapseAll(){Q(fr(!0))},expandAll(){Q(fr(!1))},setAttributeSwatch(w,M,I){Q(Ni(w,M,I))},dragGroup(w,M,I){ve(w)||Q(Je("그룹 이동",Ue(w,M,I)))},resizeGroup(w,M){ve(w)||Q(Os(w,M))},setGroupSwatch(w,M){Q(Ls(w,M))},setGroupLocked(w,M){Q(Ps(w,M))},isGroupLocked(w){return ve(w)},updateGroup(w,M){ve(w)||Q(Vs(w,M))},createGroup(w,M){if(!w.length)return null;const I=[];for(const de of o.logical.groups)for(const J of w)de.memberEntityRefs.includes(J)&&I.push(vi(de.modelId,J));const D=De(),B={modelId:D,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...w]};return I.push(wi(B,Me(w))),Q(Je("그룹 생성",I)),U.value=null,D},addEmptyGroup(w,M){const I=De();return Q(wi({modelId:I,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),I},removeGroup(w){ve(w)||Q(Ms(w))},dropEntity(w,M,I){var de;if(me(w))return;const D=((de=o.logical.groups.find(J=>J.memberEntityRefs.includes(w)))==null?void 0:de.modelId)??null,B=[Yn(w,M)];D!==I&&(D&&B.push(vi(D,w)),I&&B.push(Bs(I,w))),Q(Je("이동",B))},ungroupEntity(w){const M=o.logical.groups.find(I=>I.memberEntityRefs.includes(w));M&&Q(vi(M.modelId,w))},dropNote(w,M,I){var de;const D=((de=o.layout.groupLayouts.find(J=>{var X;return(X=J.memberNoteRefs)==null?void 0:X.includes(w)}))==null?void 0:de.groupRef)??null,B=[Co(w,M)];D!==I&&(D&&B.push(rc(D,w)),I&&B.push(ac(I,w))),Q(Je("이동",B))},addPredefinedEmbed(w,M){if(me(w))return;const I=a.value.find(te=>te.type===M),D=o.logical.entities.find(te=>te.modelId===w);if(!I||!D)return;const B=D.attributes.reduce((te,re)=>Math.max(te,re.order),-1)+1,de=De(),J=I.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),X={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:J};return Q(Ut(w,X)),de},addAttribute(w,M={}){if(me(w))return M.modelId??"";const I=o.logical.entities.find(Ne=>Ne.modelId===w),D=I?I.attributes.length:0,B=M.modelId??De(),de=M.name??`field${D}`,J={modelId:B,name:de,type:M.type??Xa,attrType:M.attrType??"NORMAL",identifier:M.identifier??!1,notNull:M.notNull??!1,order:D,dbAttrs:M.dbAttrs??[{modelId:De(),physicalName:de,dataType:"VARCHAR",length:255}],...M},X=Ut(w,J),te=ro(o.logical,w,Ne=>[...Ne,J]),re=lo(te,w);return Q(re.length?Je("속성 추가",[X,...re]):X),B},addDivider(w){if(me(w))return"";const M=o.logical.entities.find(de=>de.modelId===w),I=M?M.attributes.length:0,D=De();return Q(Ut(w,{modelId:D,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),D},updateAttribute(w,M,I){$e(w,M,I)},setAttributeGroupCode(w,M,I){$e(w,M,{groupCode:I,type:I?Ln:Xa})},setEmbedColumns(w,M,I){var te,re;if(me(w))return;const D=gn(w,M,{dbAttrs:I}),B=(te=o.logical.entities.find(Ne=>Ne.modelId===w))==null?void 0:te.attributes.find(Ne=>Ne.modelId===M),de=(re=B==null?void 0:B.embedded)==null?void 0:re.associationRef,J=de?o.logical.associations.find(Ne=>Ne.modelId===de):void 0,X=[];J&&de&&(J.end1.legacyEmbedRaw&&X.push(Qt(de,"end1",{legacyEmbedRaw:void 0})),J.end2.legacyEmbedRaw&&X.push(Qt(de,"end2",{legacyEmbedRaw:void 0}))),Q(X.length?Je("임베드 컬럼 수정",[D,...X]):D)},removeAttribute(w,M){if(me(w))return;if(Ri(o.logical,w,M)){A(Hu);return}const I=Wn(w,M),D=ro(o.logical,w,de=>de.filter(J=>J.modelId!==M)),B=lo(D,w);Q(B.length?Je("속성 삭제",[I,...B]):I)},removeAttributes(w,M){var X;if(!M.length||me(w))return;const I=M.filter(te=>!Ri(o.logical,w,te));if(I.length<M.length&&A(Hu),!I.length)return;const D=I.map(te=>Wn(w,te)),B=new Set(I),de=ro(o.logical,w,te=>te.filter(re=>!B.has(re.modelId))),J=[...D,...lo(de,w)];Q(J.length===1?J[0]:Je("속성 삭제",J)),((X=U.value)==null?void 0:X.kind)==="attribute"&&U.value.entityId===w&&(U.value=null)},setAttributeSwatches(w,M,I){M.length&&(M.length===1?Q(Ni(w,M[0],I)):Q(Je("속성 색상",M.map(D=>Ni(w,D,I)))))},reorderAttributes(w,M,I){!M.length||me(w)||Q(pr(w,M,I))},addIndex(w,M){me(w)||Q(Ks(w,M))},updateIndex(w,M,I){me(w)||Q(Ys(w,M,I))},removeIndex(w,M){me(w)||Q(Ws(w,M))},addOperation(w,M={}){var J;if(me(w))return M.modelId??"";const I=o.logical.entities.find(X=>X.modelId===w),D=((J=I==null?void 0:I.operations)==null?void 0:J.length)??0,B=M.modelId??De(),de={modelId:B,name:M.name??`method${D}`,visibility:M.visibility??"PACKAGE",order:D,...M};return Q(zs(w,de)),B},updateOperation(w,M,I){me(w)||Q(Us(w,M,I))},removeOperation(w,M){me(w)||Q(Fs(w,M))},reorderOperations(w,M,I){!M.length||me(w)||Q(Hs(w,M,I))},setOperationSwatch(w,M,I){Q(Gs(w,M,I))},addAssociation(w,M,I,D){if(me(w)||me(M))return"";const B=De(),de={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:M,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},J={...o.logical,associations:[...o.logical.associations,de]},X=So(J,M,De),te=X.add[0];te&&(de.end2.attributeRef=te.modelId);const re={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(te==null?void 0:te.modelId)??D},Ne=xi(de,re),$=ha(M,X);return Q($.length?Je("관계 추가",[Ne,...$]):Ne),B},addEmbedAssociation(w,M){if(me(w))return;const I=o.logical.entities.find(ze=>ze.modelId===w),D=o.logical.entities.find(ze=>ze.modelId===M);if(!I||!D||D.stereotype!=="JPA_EMBEDDABLE")return;const B=De(),de=De(),J=De(),X=I.attributes.reduce((ze,z)=>Math.max(ze,z.order),-1)+1,te=Ku(D),re=ze=>ze&&ze.charAt(0).toLowerCase()+ze.slice(1),Ne=new Set(I.attributes.map(ze=>ze.name)),$=re(D.name);let Z=$;for(let ze=2;Ne.has(Z);ze++)Z=`${$}${ze}`;const F={modelId:de,name:Z,type:D.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:X,dbAttrs:te,embedded:{associationRef:B,embeddableRef:M}},Ie={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:J},end2:{entityRef:M,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},ye={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return Q(Je("임베드 추가",[Ut(w,F),xi(Ie,ye)])),B},setEmbedCardinality(w,M){var $;if(Ee(w))return;const I=o.logical.associations.find(Z=>Z.modelId===w);if(!I)return;let D,B;for(const Z of o.logical.entities){const F=Z.attributes.find(Ie=>{var ye;return((ye=Ie.embedded)==null?void 0:ye.associationRef)===w&&Ie.attrType==="EMBED_OWN"});if(F){D=Z.modelId,B=F;break}}if(!D||!B)return;const de=B.embedded.embeddableRef,J=I.end2.entityRef===de?"end2":"end1",X=I[J];if(X.multiplicity===M)return;const te=Z=>Z==="ZERO_OR_MORE_INSTANCES"||Z==="ONE_OR_MORE_INSTANCES",re=te(X.multiplicity),Ne=te(M);if(re===Ne){Q(Qt(w,J,{multiplicity:M}));return}if(Ne)Q(Je("임베드 컬렉션 전환",[gn(D,B.modelId,{dbAttrs:[]}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:(($=X.jpa)==null?void 0:$.collectionType)??"LIST"}})]));else{const Z=o.logical.entities.find(F=>F.modelId===de);if(!Z)return;Q(Je("임베드 단일 전환",[gn(D,B.modelId,{dbAttrs:Ku(Z)}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(w){if(Ee(w))return;const M=o.logical.associations.find(J=>J.modelId===w),I=js(w);if(!M){Q(I);return}for(const J of o.logical.entities){const X=J.attributes.find(te=>{var re;return((re=te.embedded)==null?void 0:re.associationRef)===w});if(X){Q(Je("임베드 삭제",[I,Wn(J.modelId,X.modelId)]));return}}const D=M.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(J=>J.modelId!==w)},de=al(B,D);Q(de.length?Je("관계 삭제",[I,...de]):I)},setAssociationIdentifying(w,M){if(Ee(w))return;const I=o.logical.associations.find(X=>X.modelId===w),D=Ii(w,{identifying:M});if(!I||I.identifying===M){Q(D);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(X=>X.modelId===w?{...X,identifying:M}:X)},J=al(de,B);Q(J.length?Je("식별 관계 변경",[D,...J]):D)},updateAssociationEnd(w,M,I){Ee(w)||Q(Qt(w,M,I))},hasQuickFix(w){return S.value?ir(w,o.logical)!=null:!1},applyQuickFix(w){if(!S.value)return!1;const M=ir(w,o.logical);if(!M||Ee(M.assocRef))return!1;const I=o.logical.associations.find(D=>D.modelId===M.assocRef);return I?(Q(Qt(M.assocRef,M.which,{jpa:{...I[M.which].jpa,cascadeTypes:M.cascades}})),!0):!1},moveWaypoint(w,M,I){Q(qs(w,M,I))},addWaypoint(w,M,I){Q(Qs(w,M,I))},removeWaypoint(w,M){Q(Xs(w,M))},clearWaypoints(w){Q(Zs(w))},addNote(w="메모",M={x:80,y:80}){const I=De();return Q(ec({modelId:I,memo:w,geo:{location:{...M},size:{width:200,height:120}}})),I},removeNote(w){Q(tc(w))},moveNote(w,M){Q(Co(w,M))},resizeNote(w,M){Q(nc(w,M))},setNoteMemo(w,M){Q(oc(w,M))},setNoteSwatch(w,M){Q(ic(w,M))},addNoteConnection(w,M){Q(lc(w,M))},removeNoteConnection(w,M){Q(sc(w,M))},moveNoteConnectionWaypoint(w,M,I,D){Q(cc(w,M,I,D))},addNoteConnectionWaypoint(w,M,I,D){Q(dc(w,M,I,D))},removeNoteConnectionWaypoint(w,M,I){Q(uc(w,M,I))},clearNoteConnectionWaypoints(w,M){Q(mc(w,M))},autoLayout(){const w=Dl(o.logical,o.layout);w.length&&Q(Je("자동 배치",w.map(M=>Yn(M.id,M.location))))},copy(w){if(w&&w.length){const X=w.filter(te=>o.logical.entities.some(re=>re.modelId===te));if(X.length){be.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:o.logical,layout:o.layout},selectedIds:X}));return}}const M=U.value;if((M==null?void 0:M.kind)==="attribute"){const X=o.logical.entities.find(re=>re.modelId===M.entityId);if(!X)return;const te=[...X.attributes].sort((re,Ne)=>re.order-Ne.order).filter(re=>M.ids.includes(re.modelId));if(!te.length)return;be.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:te}));return}const I=ge.value;if(!I)return;const D=o.logical.entities.find(X=>X.modelId===I),B=o.layout.entityLayouts.find(X=>X.entityRef===I);if(!D)return;const de=(B==null?void 0:B.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let J;if(B){const{entityRef:X,geo:te,locked:re,...Ne}=B;Object.keys(Ne).length&&(J=Ne)}be.value=JSON.parse(JSON.stringify({kind:"entity",entity:D,geo:de,layoutExtras:J}))},paste(){if(!S.value)return[];const w=be.value;if(!w)return[];if(w.kind==="entities")return Ye.importEntities(w.source,w.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(w.kind==="attribute"){const de=ge.value;if(!de)return[];const J=o.logical.entities.find(Z=>Z.modelId===de);if(!J)return[];const X=new Set(J.attributes.map(Z=>Z.name)),te=new Set(J.attributes.flatMap(Z=>Z.dbAttrs.map(F=>F.physicalName))),re=J.attributes.length,Ne=[],$=w.attributes.map((Z,F)=>{const Ie=JSON.parse(JSON.stringify(Z));Ie.modelId=De();for(const ye of Ie.dbAttrs)ye.modelId=De();X.has(Ie.name)&&(Ie.name=`${Ie.name}_copy`);for(const ye of Ie.dbAttrs)ye.physicalName&&te.has(ye.physicalName)&&(ye.physicalName=`${ye.physicalName}_copy`);return Ie.order=re+F,Ne.push(Ie.modelId),Ut(de,Ie)});return Q($.length===1?$[0]:Je("속성 붙여넣기",$)),U.value={kind:"attribute",entityId:de,ids:Ne,anchor:Ne[Ne.length-1]},[]}const{clone:M,idMap:I}=qN(w.entity),D={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};let B;if(w.layoutExtras){const de={...w.layoutExtras},J=X=>I.get(X);de.attributeStyles&&(de.attributeStyles=bi(de.attributeStyles,J)),de.operationStyles&&(de.operationStyles=bi(de.operationStyles,J)),B=de}return Q(Ei(M,D,B)),U.value={kind:"entity",id:M.modelId},[M.modelId]},importEntities(w,M,I){if(!S.value)return[];const D=_s(w,M,{existing:o.logical,includeRelated:I==null?void 0:I.includeRelated,collisionSuffix:I==null?void 0:I.collisionSuffix});if(D.logical.entities.length===0)return[];const B=(I==null?void 0:I.placement)??"append-right",de=B==="append-right"?JN(o.layout,D.layout):B.offset,J=new Map(D.layout.entityLayouts.map($=>[$.entityRef,$])),X=new Map(D.layout.associationLayouts.map($=>[$.associationRef,$])),te=new Map(D.layout.groupLayouts.map($=>[$.groupRef,$])),re=[];let Ne=80;for(const $ of D.logical.entities){const Z=J.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:Ne+=40,y:80},size:{width:220,height:140}};let Ie;if(Z){const{entityRef:ye,geo:ze,locked:z,...q}=Z;Ie=q}re.push(Ei($,F,Ie))}for(const $ of D.logical.associations){const Z=X.get($.modelId),F=Z?{...Z,waypoints:Z.waypoints.map(Ie=>il(Ie,de))}:{associationRef:$.modelId,waypoints:[]};re.push(xi($,F))}for(const $ of D.logical.groups){const Z=te.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let Ie;if(Z){const{groupRef:ye,geo:ze,locked:z,memberNoteRefs:q,...ue}=Z;Ie=ue}re.push(wi($,F,Ie))}return Q(Je("다이어그램 가져오기",re)),U.value={kind:"entity",id:D.logical.entities[0].modelId},D.logical.entities.map($=>$.modelId)}};return Ye}const ya=Symbol("groupHover"),Yu=Symbol("groupDrag"),so=Symbol("relationHighlight"),tw={key:0,class:"em-sel","aria-hidden":"true"},nw=["title","aria-expanded","disabled"],ow={class:"em-entity__stereotype"},iw={key:1,class:"em-entity__name"},aw=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],rw=["onPointerdown"],lw={key:1,class:"em-entity__divider-label"},sw=["title"],cw={class:"em-key-slot"},dw={class:"em-key-slot"},uw={key:0,class:"em-entity__type"},mw=["onClick"],fw={class:"em-entity__attrname"},pw={class:"em-entity__type"},hw=["data-op"],yw=["onPointerdown"],gw={class:"em-entity__op-vis","aria-hidden":"true"},bw=["title"],_w={key:4,class:"em-entity__footer"},Wu=Ge(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=(J,X)=>o?o.t(J,X):Ct("ko",J,X),a=n.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=oe.useModal();function l(){o&&pa(r,o,t.id)}const s=n.inject(ya,null),c=n.inject(so,null),d=n.computed(()=>!!o&&o.editable.value);function u(){s&&(s.value=t.data.groupRef??null)}function m(){c==null||c.setEntityHover(t.id)}function f(){c==null||c.setEntityHover(null)}const p=n.computed(()=>!!c&&c.primaryEntityIds.value.has(t.id)),y=n.computed(()=>!!c&&c.relatedEntityIds.value.has(t.id)&&!p.value),g=n.computed(()=>{var J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===t.id}),_=n.computed(()=>!!t.selected&&!g.value),b=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),N=n.computed(()=>b.value.size>0);function h(J,X){const te=X.shiftKey?"range":X.metaKey||X.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,te)}const k=n.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(t.id)&&!g.value),P=n.computed(()=>t.data.entity),A=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),G=n.computed(()=>t.data.collapsed??!1),K=n.computed(()=>t.data.locked??!1);function v(){d.value&&(o==null||o.setEntityCollapsed(t.id,!G.value))}const T=n.computed(()=>A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL"),H=n.computed(()=>{const J=A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL",X={};for(const te of P.value.attributes){const re=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;X[te.modelId]={pk:te.identifier,fk:re&&J,required:te.notNull&&!te.identifier}}return X});function C(J){if(!J)return"";const X=[];return J.pk&&J.fk?X.push(i("em.node.keyPfk")):J.pk?X.push(i("em.node.keyPk")):J.fk&&X.push(i("em.node.keyFk")),J.required&&X.push(i("em.node.required")),X.join(" · ")}const ae=n.computed(()=>{const J=tl(ut(t.data.style)),X={};return J&&(X["--em-header-bg"]=J.bar,X["--em-header-fg"]=J.barOn),X});function E(J){var X,te;return(te=tl(ut((X=t.data.attributeStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}const Y=n.computed(()=>[...P.value.operations??[]].sort((J,X)=>J.order-X.order)),S=n.computed(()=>A.value==="CLASS"&&Y.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ee(J){return J?W[J]:"~"}function ie(J){var X,te;return(te=tl(ut((X=t.data.operationStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}function O(J,X,te){switch(A.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:te||J}];case"LOGICAL":return[X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0};return te?[re,{text:` · ${te}`}]:[re]}}}function U(J){var X,te,re;return ne(J)?[{text:J.name}]:O(J.name,(te=(X=J.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:te[a.value],((re=J.dbAttrs[0])==null?void 0:re.physicalName)??"")}function ne(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function ce(J){return J.attrType==="DIVIDER"}function ge(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const X=o==null?void 0:o.embeddableCatalog.value.find(re=>re.type===J.type);if(!X)return J.dbAttrs;const te=mn(un(P.value,(o==null?void 0:o.state.logical.entities)??[]));return J.dbAttrs.map((re,Ne)=>{const $=X.fields[Ne],Z=zn(re,te);return Z?{...re,physicalName:Z.physicalName,logicalName:re.logicalName??($==null?void 0:$.logicalName),dataType:re.dataType||($==null?void 0:$.dataType)||""}:$?{...re,physicalName:re.physicalName||$.physicalName,logicalName:re.logicalName??$.logicalName,dataType:re.dataType||$.dataType,length:re.length??$.length}:re})}function se(J){var X;return O(J.physicalName,(X=J.logicalName)==null?void 0:X[a.value],J.physicalName)}function pe(J){const X=Ja(J,(o==null?void 0:o.state.logical.associations)??[]);return Za(A.value,J,X)}const be=n.computed(()=>{var J,X,te;return O(P.value.name,(X=(J=P.value.table)==null?void 0:J.logicalName)==null?void 0:X[a.value],((te=P.value.table)==null?void 0:te.physicalName)??"")}),xe=n.ref(!1),Te=n.ref(""),Ae=n.ref(null);async function fe(){var J,X;d.value&&(Te.value=P.value.name,xe.value=!0,await n.nextTick(),(J=Ae.value)==null||J.focus(),(X=Ae.value)==null||X.select())}function ke(){if(!xe.value)return;xe.value=!1;const J=Te.value.trim();J&&J!==P.value.name&&(o==null||o.renameEntity(t.id,J))}function we(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:L,findNode:x}=He(),R=n.ref(null),V=n.computed(()=>{const J=R.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let Q=null;function me(J){var re,Ne,$;if(!d.value)return;J.stopPropagation();const X=(re=x(t.id))==null?void 0:re.dimensions,te=L({x:J.clientX,y:J.clientY});Q={fx:te.x,fy:te.y,w:(X==null?void 0:X.width)??((Ne=t.data.size)==null?void 0:Ne.width)??200,h:(X==null?void 0:X.height)??(($=t.data.size)==null?void 0:$.height)??120},J.target.setPointerCapture(J.pointerId)}function ve(J){if(!Q)return;const X=L({x:J.clientX,y:J.clientY});R.value={width:Math.max(40,Q.w+(X.x-Q.fx)),height:Math.max(40,Q.h+(X.y-Q.fy))}}function Ee(J){var X,te,re;if(Q&&R.value&&o){const Ne=(X=x(t.id))==null?void 0:X.dimensions;o.resizeEntity(t.id,{width:Math.round((Ne==null?void 0:Ne.width)??R.value.width),height:Math.round((Ne==null?void 0:Ne.height)??R.value.height)})}Q=null,R.value=null,(re=(te=J.target).releasePointerCapture)==null||re.call(te,J.pointerId)}const $e=n.ref(null),Me=n.ref(null);function Ue(J,X){if(!d.value)return;X.stopPropagation(),X.preventDefault();const te=b.value,re=te.has(J.modelId)?new Set(te):new Set([J.modelId]);Me.value={ids:re,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId)}function Ye(J){if(!Me.value||!$e.value)return;const X=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;Me.value={...Me.value,dropIndex:te,lineY:Ne}}function Fe(){const J=Me.value;if(Me.value=null,!J||J.dropIndex<0)return;const X=P.value.attributes,te=X.filter(F=>J.ids.has(F.modelId)).map(F=>F.modelId),re=X.filter((F,Ie)=>J.ids.has(F.modelId)&&Ie<J.dropIndex).length,Ne=J.dropIndex-re,$=X.filter(F=>!J.ids.has(F.modelId)).map(F=>F.modelId);[...$.slice(0,Ne),...te,...$.slice(Ne)].join(",")!==X.map(F=>F.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,te,Ne))}function gt(){Me.value=null}const w=n.ref(null),M=n.ref(null);function I(J,X){d.value&&(X.stopPropagation(),X.preventDefault(),M.value={id:J.modelId,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId))}function D(J){if(!M.value||!w.value)return;const X=Array.from(w.value.querySelectorAll(".em-entity__op-row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;M.value={...M.value,dropIndex:te,lineY:Ne}}function B(){const J=M.value;if(M.value=null,!J||J.dropIndex<0)return;const te=Y.value.findIndex(Ne=>Ne.modelId===J.id);if(te<0)return;const re=J.dropIndex-(te<J.dropIndex?1:0);re!==te&&(o==null||o.reorderOperations(t.id,[J.id],re))}function de(){M.value=null}return(J,X)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":y.value,"is-dimmed":k.value,"is-selected":g.value,"is-multi-selected":_.value,"has-focused-attr":N.value,"is-locked":K.value}]),style:n.normalizeStyle(V.value),onPointerdown:u,onMouseenter:m,onMouseleave:f,onDblclick:l},[g.value?(n.openBlock(),n.createElementBlock("div",tw,[...X[7]||(X[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(ae.value),onDblclick:n.withModifiers(fe,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:i(G.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!G.value,disabled:!d.value,onClick:n.withModifiers(v,["stop"]),onPointerdown:X[0]||(X[0]=n.withModifiers(()=>{},["stop"])),onDblclick:X[1]||(X[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(G.value?"▸":"▾"),41,nw),n.createElementVNode("span",ow,"«"+n.toDisplayString(P.value.stereotype)+"»",1),xe.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ae,"onUpdate:modelValue":X[2]||(X[2]=te=>Te.value=te),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(ke,["enter"]),X[3]||(X[3]=n.withKeys(te=>xe.value=!1,["esc"]))],onBlur:ke,onPointerdown:X[4]||(X[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,Te.value]]):(n.openBlock(),n.createElementBlock("span",iw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(te,re)=>(n.openBlock(),n.createElementBlock("span",{key:re,class:n.normalizeClass({"em-entity__missing":te.missing})},n.toDisplayString(te.text),3))),128))])),K.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)],36),G.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[Me.value&&Me.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${Me.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value.attributes,te=>{var re,Ne,$,Z;return n.openBlock(),n.createElementBlock(n.Fragment,{key:te.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(te.modelId),"is-dragging":(re=Me.value)==null?void 0:re.ids.has(te.modelId),"is-embed":ne(te),"is-divider":ce(te),nodrag:ce(te)&&d.value}]),"data-attr":te.modelId,onClick:n.withModifiers(F=>h(te,F),["stop"]),onPointerdown:F=>ce(te)?Ue(te,F):void 0,onPointermove:F=>ce(te)?Ye(F):void 0,onPointerup:F=>ce(te)?Fe():void 0,onPointercancel:F=>ce(te)?gt():void 0},[d.value&&!ce(te)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:F=>Ue(te,F),onPointermove:Ye,onPointerup:Fe,onPointercancel:gt,onClick:X[5]||(X[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,rw)):n.createCommentVNode("",!0),ce(te)?(n.openBlock(),n.createElementBlock("span",lw,n.toDisplayString(te.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(In),{id:`l:${te.modelId}`,type:"target",position:n.unref(Re).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:C(H.value[te.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",cw,[(Ne=H.value[te.modelId])!=null&&Ne.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):($=H.value[te.modelId])!=null&&$.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",dw,[ne(te)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Z=H.value[te.modelId])!=null&&Z.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,sw),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:E(te)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(U(te),(F,Ie)=>(n.openBlock(),n.createElementBlock("span",{key:Ie,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))],4),pe(te)?(n.openBlock(),n.createElementBlock("span",uw,n.toDisplayString(pe(te)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(In),{id:`r:${te.modelId}`,type:"source",position:n.unref(Re).Right,class:"em-handle"},null,8,["id","position"])],64))],42,aw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne(te)&&T.value?ge(te):[],F=>(n.openBlock(),n.createElementBlock("li",{key:`${te.modelId}:${F.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(te.modelId)}]),onClick:n.withModifiers(Ie=>h(te,Ie),["stop"])},[X[8]||(X[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",fw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se(F),(Ie,ye)=>(n.openBlock(),n.createElementBlock("span",{key:ye,class:n.normalizeClass({"em-entity__missing":Ie.missing})},n.toDisplayString(Ie.text),3))),128))]),n.createElementVNode("span",pw,n.toDisplayString(F.dataType),1)],10,mw))),128))],64)}),128))],512)),!G.value&&S.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:w,class:"em-entity__ops"},[M.value&&M.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${M.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Y.value,te=>{var re;return n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((re=M.value)==null?void 0:re.id)===te.modelId}]),"data-op":te.modelId},[d.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ne=>I(te,Ne),onPointermove:D,onPointerup:B,onPointercancel:de,onClick:X[6]||(X[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,yw)):n.createCommentVNode("",!0),n.createElementVNode("span",gw,n.toDisplayString(ee(te.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:ie(te)})},n.toDisplayString(te.name)+"()",5)],10,hw)}),128))],512)):Y.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Y.value.length})},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,n.toDisplayString(i("em.node.opsSummary",{n:Y.value.length})),1)],8,bw)):n.createCommentVNode("",!0),d.value?(n.openBlock(),n.createElementBlock("footer",_w,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:we},n.toDisplayString(i("em.node.addAttr")),1),X[9]||(X[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:j},n.toDisplayString(i("em.node.addDivider")),1)])):n.createCommentVNode("",!0),d.value&&!xe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:me,onPointermove:ve,onPointerup:Ee},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3ffbbf24"]]),kw={key:0,class:"em-sel","aria-hidden":"true"},Ew={class:"em-group__label"},Nw={class:"em-group__name"},ww={key:0,class:"em-group__pkg"},vw={key:1,class:"em-group__flag"},qu=Ge(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>ut(t.data.style)),r=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=n.inject(An,null),s=(T,H)=>l?l.t(T,H):Ct("ko",T,H),c=n.computed(()=>!!l&&l.editable.value),d=n.computed(()=>{var T;return!!t.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===t.id}),u=n.computed(()=>!!t.selected&&!d.value),m=n.inject(ya,null),f=n.computed(()=>!!t.id&&(m==null?void 0:m.value)===t.id),p=n.inject(so,null);function y(){t.id&&(p==null||p.setGroupHover(t.id))}function g(){p==null||p.setGroupHover(null)}const _=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),b=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:N,findNode:h}=He();let k=null,P=null;function A(T){var ae;if(!t.id||!c.value)return;T.stopPropagation();const H=((ae=h(t.id))==null?void 0:ae.dimensions)??{width:400,height:300},C=N({x:T.clientX,y:T.clientY});k={fx:C.x,fy:C.y,w:H.width,h:H.height},T.target.setPointerCapture(T.pointerId)}function G(T){if(!k||!t.id)return;const H=N({x:T.clientX,y:T.clientY});P={width:Math.max(160,k.w+(H.x-k.fx)),height:Math.max(120,k.h+(H.y-k.fy))};const C=h(t.id);C&&(C.style={width:`${P.width}px`,height:`${P.height}px`})}function K(T){var H,C;k&&P&&t.id&&l&&l.resizeGroup(t.id,P),k=null,P=null,(C=(H=T.target).releasePointerCapture)==null||C.call(H,T.pointerId)}const v=n.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||s("em.group.fallback")});return(T,H)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":_.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),style:n.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(n.openBlock(),n.createElementBlock("div",kw,[...H[0]||(H[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Ew,[n.createElementVNode("span",Nw,n.toDisplayString(v.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",ww,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",vw,n.toDisplayString(s("em.group.ddlExcludeBadge")),1)):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)]),c.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:G,onPointerup:K},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-9b95a9b6"]]),xw={key:0,class:"em-sel","aria-hidden":"true"},Iw={key:2,class:"em-note__text"},Xu=Ge(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=n.inject(ya,null),a=n.inject(so,null),r=n.computed(()=>t.data.note),l=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>ut(r.value.style)),c=n.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function m(){a==null||a.setNoteHover(null)}const f=n.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!f.value),y=n.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!y.value),_=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.value),b=[{id:"n-top",pos:Re.Top},{id:"n-right",pos:Re.Right},{id:"n-bottom",pos:Re.Bottom},{id:"n-left",pos:Re.Left}],N=n.ref(!1),h=n.ref(""),k=n.ref(null);async function P(){var E;l.value&&(h.value=r.value.memo,N.value=!0,await n.nextTick(),(E=k.value)==null||E.focus())}function A(){N.value&&(N.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:G,findNode:K}=He();let v=null,T=null;function H(E){var W;if(!l.value)return;E.stopPropagation();const Y=((W=K(t.id))==null?void 0:W.dimensions)??r.value.geo.size,S=G({x:E.clientX,y:E.clientY});v={fx:S.x,fy:S.y,w:Y.width,h:Y.height},E.target.setPointerCapture(E.pointerId)}function C(E){if(!v)return;const Y=G({x:E.clientX,y:E.clientY});T={width:Math.max(140,v.w+(Y.x-v.fx)),height:Math.max(60,v.h+(Y.y-v.fy))};const S=K(t.id);S&&(S.style={width:`${T.width}px`,height:`${T.height}px`})}function ae(E){var Y,S;v&&T&&o&&o.resizeNote(t.id,T),v=null,T=null,(S=(Y=E.target).releasePointerCapture)==null||S.call(Y,E.pointerId)}return(E,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(c.value),onDblclick:P,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(n.openBlock(),n.createElementBlock("div",xw,[...Y[4]||(Y[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":Y[0]||(Y[0]=S=>h.value=S),class:"em-note__edit nodrag",onBlur:A,onKeydown:Y[1]||(Y[1]=n.withKeys(S=>N.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",Iw,n.toDisplayString(r.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(b,S=>n.createVNode(n.unref(In),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:H,onPointermove:C,onPointerup:ae},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Cw=20,Sw=22,$w=7,Rw=22,Ju=31,Zu=7,Aw=20,Qu=11,em=11,Tw=Ju+Zu;function Vw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Mw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ga(e,t,o){const i=t.x-e.x,a=t.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tm(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function ba(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function nm(e,t,o,i){const a=i/2,r=e.x===t.x&&e.y===t.y?Math.PI/2:tm(e,t);return[ba(o,a,r-Math.PI/2),ba(o,a,r+Math.PI/2)]}function om(e,t,o,i){const a=t*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function im(e,t,o,i){const a=[],r=[],l=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=ga(e,t,Cw),[d,u]=nm(e,t,c,Sw);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),Vw(o.multiplicity)){const m=ga(e,t,Ju);r.push({cx:m.x,cy:m.y,r:Zu})}if(Mw(o.multiplicity)){const m=ga(e,t,$w),[f,p]=nm(e,t,m,Rw);a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=ga(e,t,Aw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tm(e,t),m=ba(d,Qu/2,u-Math.PI/2),f=ba(d,Qu/2,u+Math.PI/2);l.push({points:[e,m,c,f]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=om(s,c,em,!0),u=om(s,c,em,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const am=200,rm=120,rl=24;function lm(e){var a,r;if(!e)return{x:0,y:0,width:am,height:rm};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||am,i=((r=e.dimensions)==null?void 0:r.height)||rm;return{x:t.x,y:t.y,width:o,height:i}}function sm(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cm(e){const t=n.computed(()=>lm(e.sourceNode())),o=n.computed(()=>lm(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,y;const d=t.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,f=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(f-m)<rl){const g=(m+f)/2;m=g-rl/2,f=g+rl/2}return{source:{x:u,y:m},target:{x:u,y:f}}}),r=n.computed(()=>e.waypoints()[0]??sm(o.value)),l=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??sm(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Fa(t.value,d,r.value.x):Ua(t.value,r.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Fa(o.value,d,l.value.x):Ua(o.value,l.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ll=Symbol("waypointController"),Bw=["d"],Dw=["d"],Ow=["d"],Lw=["x1","y1","x2","y2"],Pw=["cx","cy","r"],zw=["x","y"],Uw=["x","y"],Fw=["cx","cy","onDblclick"],Hw=["x","y","onPointerdown","onDblclick"],dm=Ge(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(Yu,null),s=n.inject(so,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var fe;return((fe=a==null?void 0:a.selection.value)==null?void 0:fe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),m=n.computed(()=>{const fe=l==null?void 0:l.value;if(!fe||!a)return null;const ke=a.resolved.value.entities,we=L=>{var x;return(x=ke.find(R=>R.entity.modelId===L))==null?void 0:x.groupRef},j=t.data.association;return we(j.end1.entityRef)===fe.groupId&&we(j.end2.entityRef)===fe.groupId?{dx:fe.dx,dy:fe.dy}:null}),f=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),y=n.ref({x:0,y:0}),g=n.computed(()=>{const fe=m.value;return f.value.map((ke,we)=>we===p.value?y.value:fe?{x:ke.x+fe.dx,y:ke.y+fe.dy}:ke)}),_=n.computed(()=>{var fe;return!!((fe=t.sourceNode.data)!=null&&fe.collapsed)}),b=n.computed(()=>{var fe;return!!((fe=t.targetNode.data)!=null&&fe.collapsed)}),{source:N,target:h,sourceSide:k,targetSide:P,isSelf:A}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!_.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),G=Tw+4,K=n.computed(()=>A.value?Bl(N.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?La(N.value,k.value,g.value,h.value,P.value,G):za(N.value,g.value,h.value)),v=n.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(N.value,k.value,g.value,h.value,P.value,G):Ha(N.value,g.value,h.value).map((fe,ke)=>({point:fe,segIndex:ke}))),T=n.computed(()=>A.value||!r.value?[]:g.value);function H(fe){switch(fe){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function C(fe,ke){p.value=fe,y.value={...f.value[fe]},ke.target.setPointerCapture(ke.pointerId),ke.stopPropagation()}function ae(fe){if(p.value<0)return;const ke=o({x:fe.clientX,y:fe.clientY});y.value={x:ke.x,y:ke.y}}function E(fe){var ke,we;p.value>=0&&i&&i.movePoint(t.id,p.value,{...y.value}),p.value=-1,(we=(ke=fe.target).releasePointerCapture)==null||we.call(ke,fe.pointerId)}function Y(fe,ke){ke.stopPropagation(),i==null||i.removePoint(t.id,fe)}function S(fe,ke){if(!i)return;const we=o({x:ke.clientX,y:ke.clientY});i.insertPoint(t.id,fe,{x:we.x,y:we.y})}const W=n.computed(()=>H(t.data.association.end1.multiplicity)),ee=n.computed(()=>H(t.data.association.end2.multiplicity)),ie=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),O=n.computed(()=>ie.value==="class"),U=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const fe=ho(k.value);return{x:N.value.x+fe.x*10,y:N.value.y+fe.y*10}}return g.value[0]??h.value}),ne=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ke=ho(P.value);return{x:h.value.x+ke.x*10,y:h.value.y+ke.y*10}}const fe=g.value;return fe[fe.length-1]??N.value}),ce=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end1.multiplicity,navigable:fe.end1.navigable,composition:fe.end1.composition,otherNavigable:fe.end2.navigable}}),ge=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end2.multiplicity,navigable:fe.end2.navigable,composition:fe.end2.composition,otherNavigable:fe.end1.navigable}}),se=n.computed(()=>im(N.value,U.value,ce.value,ie.value)),pe=n.computed(()=>im(h.value,ne.value,ge.value,ie.value)),be=n.computed(()=>[...se.value.lines,...pe.value.lines]),xe=n.computed(()=>[...se.value.circles,...pe.value.circles]),Te=n.computed(()=>[...se.value.polygons,...pe.value.polygons].map(fe=>`M${fe.points.map(ke=>`${ke.x},${ke.y}`).join(" L")} Z`)),Ae=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(fe,ke)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:K.value,fill:"none",class:"em-edge__hit"},null,8,Bw),n.createElementVNode("path",{d:K.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Dw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Te.value,(we,j)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${j}`,d:we,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ae.value])},null,10,Ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(we,j)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${j}`,x1:we.x1,y1:we.y1,x2:we.x2,y2:we.y2,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Lw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(xe.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${j}`,cx:we.cx,cy:we.cy,r:we.r,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Pw))),128)),O.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,zw),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(ee.value),11,Uw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${j}`,cx:we.point.x,cy:we.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(L=>S(we.segIndex,L),["stop"])},null,42,Fw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,(we,j)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${j}`,x:we.x-5,y:we.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>C(j,L),onPointermove:ae,onPointerup:E,onDblclick:L=>Y(j,L)},null,42,Hw))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Yt=(e=>(e.Lines="lines",e.Dots="dots",e))(Yt||{});const um=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},mm=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Yt.Lines+"",Yt.Dots+"";const Gw={[Yt.Dots]:"#81818a",[Yt.Lines]:"#eee"},jw=["id","x","y","width","height","patternTransform"],Kw={key:2,height:"100",width:"100"},Yw=["fill"],Ww=["x","y","fill"],qw={name:"Background",compatConfig:{MODE:3}},Xw=n.defineComponent({...qw,props:{id:{},variant:{default:()=>Yt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:o}=He(),i=n.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,f*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=n.toRef(()=>e.color||e.patternColor||Gw[e.variant||Yt.Dots]);return(l,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[n.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(l.$slots,"pattern",{},()=>[l.variant===n.unref(Yt).Lines?(n.openBlock(),n.createBlock(n.unref(um),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===n.unref(Yt).Dots?(n.openBlock(),n.createBlock(n.unref(mm),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),l.bgColor?(n.openBlock(),n.createElementBlock("svg",Kw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Yw)])):n.createCommentVNode("",!0)])],8,jw)]),n.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Ww),n.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Jw={name:"ControlButton",compatConfig:{MODE:3}},Zw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Qw={type:"button",class:"vue-flow__controls-button"};function ev(e,t,o,i,a,r){return n.openBlock(),n.createElementBlock("button",Qw,[n.renderSlot(e.$slots,"default")])}const Tn=Zw(Jw,[["render",ev]]),tv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},nv=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function ov(e,t){return n.openBlock(),n.createElementBlock("svg",tv,nv)}const iv={render:ov},av={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},rv=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function lv(e,t){return n.openBlock(),n.createElementBlock("svg",av,rv)}const sv={render:lv},cv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},dv=[n.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function uv(e,t){return n.openBlock(),n.createElementBlock("svg",cv,dv)}const mv={render:uv},fv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pv=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function hv(e,t){return n.openBlock(),n.createElementBlock("svg",fv,pv)}const yv={render:hv},gv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},bv=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function _v(e,t){return n.openBlock(),n.createElementBlock("svg",gv,bv)}const kv={render:_v},Ev={name:"Controls",compatConfig:{MODE:3}},Nv=n.defineComponent({...Ev,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Md.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=He(),f=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=m.value);function g(){l(),t("zoomIn")}function _(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function N(){r(!f.value),t("interactionChange",!f.value)}return(h,k)=>(n.openBlock(),n.createBlock(n.unref(Tu),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(Tn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(iv))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(Tn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(sv))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Tn,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(mv))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(Tn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[f.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(kv))))]):n.createCommentVNode("",!0),f.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(yv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var wv={value:()=>{}};function sl(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new _a(o)}function _a(e){this._=e}function vv(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}_a.prototype=sl.prototype={constructor:_a,on:function(e,t){var o=this._,i=vv(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=xv(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fm(o[a],e.name,t);else if(t==null)for(a in o)o[a]=fm(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new _a(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(t,o)}};function xv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function fm(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var cl="http://www.w3.org/1999/xhtml";const pm={svg:"http://www.w3.org/2000/svg",xhtml:cl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ka(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pm.hasOwnProperty(t)?{space:pm[t],local:e}:e}function Iv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===cl&&t.documentElement.namespaceURI===cl?t.createElement(e):t.createElementNS(o,e)}}function Cv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hm(e){var t=ka(e);return(t.local?Cv:Iv)(t)}function Sv(){}function dl(e){return e==null?Sv:function(){return this.querySelector(e)}}function $v(e){typeof e!="function"&&(e=dl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Et(i,this._parents)}function Rv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Av(){return[]}function ym(e){return e==null?Av:function(){return this.querySelectorAll(e)}}function Tv(e){return function(){return Rv(e.apply(this,arguments))}}function Vv(e){typeof e=="function"?e=Tv(e):e=ym(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Et(i,a)}function gm(e){return function(){return this.matches(e)}}function bm(e){return function(t){return t.matches(e)}}var Mv=Array.prototype.find;function Bv(e){return function(){return Mv.call(this.children,e)}}function Dv(){return this.firstElementChild}function Ov(e){return this.select(e==null?Dv:Bv(typeof e=="function"?e:bm(e)))}var Lv=Array.prototype.filter;function Pv(){return Array.from(this.children)}function zv(e){return function(){return Lv.call(this.children,e)}}function Uv(e){return this.selectAll(e==null?Pv:zv(typeof e=="function"?e:bm(e)))}function Fv(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Et(i,this._parents)}function _m(e){return new Array(e.length)}function Hv(){return new Et(this._enter||this._groups.map(_m),this._parents)}function Ea(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ea.prototype={constructor:Ea,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Gv(e){return function(){return e}}function jv(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Ea(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Kv(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Ea(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Yv(e){return e.__data__}function Wv(e,t){if(!arguments.length)return Array.from(this,Yv);var o=t?Kv:jv,i=this._parents,a=this._groups;typeof e!="function"&&(e=Gv(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],f=m.length,p=qv(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new Et(l,i),l._enter=s,l._exit=c,l}function qv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xv(){return new Et(this._exit||this._groups.map(_m),this._parents)}function Jv(e,t,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Zv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new Et(s,this._parents)}function Qv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function ex(e){e||(e=tx);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(t)}return new Et(a,this._parents).order()}function tx(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ox(){return Array.from(this)}function ix(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function ax(){let e=0;for(const t of this)++e;return e}function rx(){return!this.node()}function lx(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function sx(e){return function(){this.removeAttribute(e)}}function cx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dx(e,t){return function(){this.setAttribute(e,t)}}function ux(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mx(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function fx(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function px(e,t){var o=ka(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?cx:sx:typeof t=="function"?o.local?fx:mx:o.local?ux:dx)(o,t))}function km(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hx(e){return function(){this.style.removeProperty(e)}}function yx(e,t,o){return function(){this.style.setProperty(e,t,o)}}function gx(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function bx(e,t,o){return arguments.length>1?this.each((t==null?hx:typeof t=="function"?gx:yx)(e,t,o??"")):co(this.node(),e)}function co(e,t){return e.style.getPropertyValue(t)||km(e).getComputedStyle(e,null).getPropertyValue(t)}function _x(e){return function(){delete this[e]}}function kx(e,t){return function(){this[e]=t}}function Ex(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Nx(e,t){return arguments.length>1?this.each((t==null?_x:typeof t=="function"?Ex:kx)(e,t)):this.node()[e]}function Em(e){return e.trim().split(/^|\s+/)}function ul(e){return e.classList||new Nm(e)}function Nm(e){this._node=e,this._names=Em(e.getAttribute("class")||"")}Nm.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function vm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wx(e){return function(){wm(this,e)}}function vx(e){return function(){vm(this,e)}}function xx(e,t){return function(){(t.apply(this,arguments)?wm:vm)(this,e)}}function Ix(e,t){var o=Em(e+"");if(arguments.length<2){for(var i=ul(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?xx:t?wx:vx)(o,t))}function Cx(){this.textContent=""}function Sx(e){return function(){this.textContent=e}}function $x(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Rx(e){return arguments.length?this.each(e==null?Cx:(typeof e=="function"?$x:Sx)(e)):this.node().textContent}function Ax(){this.innerHTML=""}function Tx(e){return function(){this.innerHTML=e}}function Vx(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mx(e){return arguments.length?this.each(e==null?Ax:(typeof e=="function"?Vx:Tx)(e)):this.node().innerHTML}function Bx(){this.nextSibling&&this.parentNode.appendChild(this)}function Dx(){return this.each(Bx)}function Ox(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lx(){return this.each(Ox)}function Px(e){var t=typeof e=="function"?e:hm(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zx(){return null}function Ux(e,t){var o=typeof e=="function"?e:hm(e),i=t==null?zx:typeof t=="function"?t:dl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Fx(){var e=this.parentNode;e&&e.removeChild(this)}function Hx(){return this.each(Fx)}function Gx(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jx(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kx(e){return this.select(e?jx:Gx)}function Yx(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wx(e){return function(t){e.call(this,t,this.__data__)}}function qx(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Xx(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Jx(e,t,o){return function(){var i=this.__on,a,r=Wx(t);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Zx(e,t,o){var i=qx(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=t?Jx:Xx,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function xm(e,t,o){var i=km(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Qx(e,t){return function(){return xm(this,e,t)}}function eI(e,t){return function(){return xm(this,e,t.apply(this,arguments))}}function tI(e,t){return this.each((typeof t=="function"?eI:Qx)(e,t))}function*nI(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Im=[null];function Et(e,t){this._groups=e,this._parents=t}function qo(){return new Et([[document.documentElement]],Im)}function oI(){return this}Et.prototype=qo.prototype={constructor:Et,select:$v,selectAll:Vv,selectChild:Ov,selectChildren:Uv,filter:Fv,data:Wv,enter:Hv,exit:Xv,join:Jv,merge:Zv,selection:oI,order:Qv,sort:ex,call:nx,nodes:ox,node:ix,size:ax,empty:rx,each:lx,attr:px,style:bx,property:Nx,classed:Ix,text:Rx,html:Mx,raise:Dx,lower:Lx,append:Px,insert:Ux,remove:Hx,clone:Kx,datum:Yx,on:Zx,dispatch:tI,[Symbol.iterator]:nI};function ln(e){return typeof e=="string"?new Et([[document.querySelector(e)]],[document.documentElement]):new Et([[e]],Im)}function iI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sn(e,t){if(e=iI(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ml={capture:!0,passive:!1};function fl(e){e.preventDefault(),e.stopImmediatePropagation()}function aI(e){var t=e.document.documentElement,o=ln(e).on("dragstart.drag",fl,ml);"onselectstart"in t?o.on("selectstart.drag",fl,ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rI(e,t){var o=e.document.documentElement,i=ln(e).on("dragstart.drag",null);t&&(i.on("click.drag",fl,ml),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function pl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Cm(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Xo(){}var Jo=.7,Na=1/Jo,uo="\\s*([+-]?\\d+)\\s*",Zo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lI=/^#([0-9a-f]{3,8})$/,sI=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),cI=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),dI=new RegExp(`^rgba\\(${uo},${uo},${uo},${Zo}\\)$`),uI=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Zo}\\)$`),mI=new RegExp(`^hsl\\(${Zo},${Lt},${Lt}\\)$`),fI=new RegExp(`^hsla\\(${Zo},${Lt},${Lt},${Zo}\\)$`),Sm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pl(Xo,Qo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$m,formatHex:$m,formatHex8:pI,formatHsl:hI,formatRgb:Rm,toString:Rm});function $m(){return this.rgb().formatHex()}function pI(){return this.rgb().formatHex8()}function hI(){return Bm(this).formatHsl()}function Rm(){return this.rgb().formatRgb()}function Qo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=lI.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Am(t):o===3?new yt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?wa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?wa(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=sI.exec(e))?new yt(t[1],t[2],t[3],1):(t=cI.exec(e))?new yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dI.exec(e))?wa(t[1],t[2],t[3],t[4]):(t=uI.exec(e))?wa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,t[4]):Sm.hasOwnProperty(e)?Am(Sm[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function Am(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function wa(e,t,o,i){return i<=0&&(e=t=o=NaN),new yt(e,t,o,i)}function yI(e){return e instanceof Xo||(e=Qo(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function hl(e,t,o,i){return arguments.length===1?yI(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}pl(yt,hl,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(Vn(this.r),Vn(this.g),Vn(this.b),va(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tm,formatHex:Tm,formatHex8:gI,formatRgb:Vm,toString:Vm}));function Tm(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function gI(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vm(){const e=va(this.opacity);return`${e===1?"rgb(":"rgba("}${Vn(this.r)}, ${Vn(this.g)}, ${Vn(this.b)}${e===1?")":`, ${e})`}`}function va(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=Vn(e),(e<16?"0":"")+e.toString(16)}function Mm(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new St(e,t,o,i)}function Bm(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);if(e instanceof Xo||(e=Qo(e)),!e)return new St;if(e instanceof St)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new St(l,s,c,e.opacity)}function bI(e,t,o,i){return arguments.length===1?Bm(e):new St(e,t,o,i??1)}function St(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}pl(St,bI,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new St(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new St(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new yt(yl(e>=240?e-240:e+120,a,i),yl(e,a,i),yl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new St(Dm(this.h),xa(this.s),xa(this.l),va(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=va(this.opacity);return`${e===1?"hsl(":"hsla("}${Dm(this.h)}, ${xa(this.s)*100}%, ${xa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dm(e){return e=(e||0)%360,e<0?e+360:e}function xa(e){return Math.max(0,Math.min(1,e||0))}function yl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Om=e=>()=>e;function _I(e,t){return function(o){return e+o*t}}function kI(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function EI(e){return(e=+e)==1?Lm:function(t,o){return o-t?kI(t,o,e):Om(isNaN(t)?o:t)}}function Lm(e,t){var o=t-e;return o?_I(e,o):Om(isNaN(e)?t:e)}const Pm=(function e(t){var o=EI(t);function i(a,r){var l=o((a=hl(a)).r,(r=hl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lm(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function cn(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var gl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bl=new RegExp(gl.source,"g");function NI(e){return function(){return e}}function wI(e){return function(t){return e(t)+""}}function vI(e,t){var o=gl.lastIndex=bl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=gl.exec(e))&&(a=bl.exec(t));)(r=a.index)>o&&(r=t.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:cn(i,a)})),o=bl.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?wI(c[0].x):NI(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zm=180/Math.PI,_l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Um(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*zm,skewX:Math.atan(c)*zm,scaleX:l,scaleY:s}}var Ia;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_l:Um(t.a,t.b,t.c,t.d,t.e,t.f)}function II(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?_l:(e=e.matrix,Um(e.a,e.b,e.c,e.d,e.e,e.f))}function Fm(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:cn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:cn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var CI=Fm(xI,"px, ","px)","deg)"),SI=Fm(II,", ",")",")"),$I=1e-12;function Hm(e){return((e=Math.exp(e))+1/e)/2}function RI(e){return((e=Math.exp(e))-1/e)/2}function AI(e){return((e=Math.exp(2*e))-1)/(e+1)}const TI=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<$I)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Hm(P),T=d/(o*N)*(v*AI(t*K+P)-RI(P));return[s+T*p,c+T*y,d*v/Hm(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var mo=0,ei=0,ti=0,Gm=1e3,Ca,ni,Sa=0,Bn=0,$a=0,oi=typeof performance=="object"&&performance.now?performance:Date,jm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kl(){return Bn||(jm(VI),Bn=oi.now()+$a)}function VI(){Bn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=Km.prototype={constructor:Ra,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?kl():+o)+(t==null?0:+t),!this._next&&ni!==this&&(ni?ni._next=this:Ca=this,ni=this),this._call=e,this._time=o,El()},stop:function(){this._call&&(this._call=null,this._time=1/0,El())}};function Km(e,t,o){var i=new Ra;return i.restart(e,t,o),i}function MI(){kl(),++mo;for(var e=Ca,t;e;)(t=Bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mo}function Ym(){Bn=(Sa=oi.now())+$a,mo=ei=0;try{MI()}finally{mo=0,DI(),Bn=0}}function BI(){var e=oi.now(),t=e-Sa;t>Gm&&($a-=t,Sa=e)}function DI(){for(var e,t=Ca,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Ca=o);ni=e,El(i)}function El(e){if(!mo){ei&&(ei=clearTimeout(ei));var t=e-Bn;t>24?(e<1/0&&(ei=setTimeout(Ym,e-oi.now()-$a)),ti&&(ti=clearInterval(ti))):(ti||(Sa=oi.now(),ti=setInterval(BI,Gm)),mo=1,jm(Ym))}}function Wm(e,t,o){var i=new Ra;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var OI=sl("start","end","cancel","interrupt"),LI=[],qm=0,Xm=1,Nl=2,Aa=3,Jm=4,wl=5,Ta=6;function Va(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;PI(e,o,{name:t,index:i,group:a,on:OI,tween:LI,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:qm})}function vl(e,t){var o=$t(e,t);if(o.state>qm)throw new Error("too late; already scheduled");return o}function Pt(e,t){var o=$t(e,t);if(o.state>Aa)throw new Error("too late; already running");return o}function $t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function PI(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Km(r,0,o.time);function r(d){o.state=Xm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Xm)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Aa)return Wm(l);p.state===Jm?(p.state=Ta,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Ta,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Wm(function(){o.state===Aa&&(o.state=Jm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Nl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Nl){for(o.state=Aa,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=wl,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===wl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ta,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ma(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Nl&&i.state<wl,i.state=Ta,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function zI(e){return this.each(function(){Ma(this,e)})}function UI(e,t){var o,i;return function(){var a=Pt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function FI(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Pt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function HI(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=$t(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((t==null?UI:FI)(o,e,t))}function xl(e,t,o){var i=e._id;return e.each(function(){var a=Pt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return $t(a,i).value[t]}}function Zm(e,t){var o;return(typeof t=="number"?cn:t instanceof Qo?Pm:(o=Qo(t))?(t=o,Pm):vI)(e,t)}function GI(e){return function(){this.removeAttribute(e)}}function jI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function KI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function YI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function WI(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function qI(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function XI(e,t){var o=ka(e),i=o==="transform"?SI:Zm;return this.attrTween(e,typeof t=="function"?(o.local?qI:WI)(o,i,xl(this,"attr."+e,t)):t==null?(o.local?jI:GI)(o):(o.local?YI:KI)(o,i,t))}function JI(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ZI(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function QI(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&ZI(e,r)),o}return a._value=t,a}function eC(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&JI(e,r)),o}return a._value=t,a}function tC(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=ka(e);return this.tween(o,(i.local?QI:eC)(i,t))}function nC(e,t){return function(){vl(this,e).delay=+t.apply(this,arguments)}}function oC(e,t){return t=+t,function(){vl(this,e).delay=t}}function iC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nC:oC)(t,e)):$t(this.node(),t).delay}function aC(e,t){return function(){Pt(this,e).duration=+t.apply(this,arguments)}}function rC(e,t){return t=+t,function(){Pt(this,e).duration=t}}function lC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aC:rC)(t,e)):$t(this.node(),t).duration}function sC(e,t){if(typeof t!="function")throw new Error;return function(){Pt(this,e).ease=t}}function cC(e){var t=this._id;return arguments.length?this.each(sC(t,e)):$t(this.node(),t).ease}function dC(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Pt(this,e).ease=o}}function uC(e){if(typeof e!="function")throw new Error;return this.each(dC(this._id,e))}function mC(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Wt(i,this._parents,this._name,this._id)}function fC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Wt(l,this._parents,this._name,this._id)}function pC(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function hC(e,t,o){var i,a,r=pC(t)?vl:Pt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function yC(e,t){var o=this._id;return arguments.length<2?$t(this.node(),o).on.on(e):this.each(hC(o,e,t))}function gC(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function bC(){return this.on("end.remove",gC(this._id))}function _C(e){var t=this._name,o=this._id;typeof e!="function"&&(e=dl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Va(d[f],t,o,f,d,$t(u,o)));return new Wt(r,this._parents,t,o)}function kC(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ym(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var f=e.call(u,u.__data__,m,c),p,y=$t(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Va(p,t,o,g,f,y);r.push(f),l.push(u)}return new Wt(r,l,t,o)}var EC=qo.prototype.constructor;function NC(){return new EC(this._groups,this._parents)}function wC(e,t){var o,i,a;return function(){var r=co(this,e),l=(this.style.removeProperty(e),co(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Qm(e){return function(){this.style.removeProperty(e)}}function vC(e,t,o){var i,a=o+"",r;return function(){var l=co(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function xC(e,t,o){var i,a,r;return function(){var l=co(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),co(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function IC(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Pt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qm(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function CC(e,t,o){var i=(e+="")=="transform"?CI:Zm;return t==null?this.styleTween(e,wC(e,i)).on("end.style."+e,Qm(e)):typeof t=="function"?this.styleTween(e,xC(e,i,xl(this,"style."+e,t))).each(IC(this._id,e)):this.styleTween(e,vC(e,i,t),o).on("end.style."+e,null)}function SC(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function $C(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&SC(e,l,o)),i}return r._value=t,r}function RC(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,$C(e,t,o??""))}function AC(e){return function(){this.textContent=e}}function TC(e){return function(){var t=e(this);this.textContent=t??""}}function VC(e){return this.tween("text",typeof e=="function"?TC(xl(this,"text",e)):AC(e==null?"":e+""))}function MC(e){return function(t){this.textContent=e.call(this,t)}}function BC(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&MC(a)),t}return i._value=e,i}function DC(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,BC(e))}function OC(){for(var e=this._name,t=this._id,o=ef(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=$t(c,t);Va(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Wt(i,this._parents,e,o)}function LC(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Pt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var PC=0;function Wt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ef(){return++PC}var qt=qo.prototype;Wt.prototype={constructor:Wt,select:_C,selectAll:kC,selectChild:qt.selectChild,selectChildren:qt.selectChildren,filter:mC,merge:fC,selection:NC,transition:OC,call:qt.call,nodes:qt.nodes,node:qt.node,size:qt.size,empty:qt.empty,each:qt.each,on:yC,attr:XI,attrTween:tC,style:CC,styleTween:RC,text:VC,textTween:DC,remove:bC,tween:HI,delay:iC,duration:lC,ease:cC,easeVarying:uC,end:LC,[Symbol.iterator]:qt[Symbol.iterator]};function zC(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var UC={time:null,delay:0,duration:250,ease:zC};function FC(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function HC(e){var t,o;e instanceof Wt?(t=e._id,e=e._name):(t=ef(),(o=UC).time=kl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Va(c,e,t,d,l,o||FC(c,t));return new Wt(i,this._parents,e,t)}qo.prototype.interrupt=zI,qo.prototype.transition=HC;const Ba=e=>()=>e;function GC(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Xt(e,t,o){this.k=e,this.x=t,this.y=o}Xt.prototype={constructor:Xt,scale:function(e){return e===1?this:new Xt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Il=new Xt(1,0,0);Xt.prototype;function Cl(e){e.stopImmediatePropagation()}function ii(e){e.preventDefault(),e.stopImmediatePropagation()}function jC(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function KC(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function tf(){return this.__zoom||Il}function YC(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WC(){return navigator.maxTouchPoints||"ontouchstart"in this}function qC(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function XC(){var e=jC,t=KC,o=qC,i=YC,a=WC,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=TI,d=sl("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",tf).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",tf),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(Il.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new Xt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new Xt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new Xt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=ln(this.that).datum();d.call(E,this.that,new GC(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=sn(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ma(this),S.start()}ii(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=ln(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=sn(E,S),O=E.clientX,U=E.clientY;aI(E.view),Cl(E),W.mouse=[ie,this.__zoom.invert(ie)],Ma(this),W.start();function ne(ge){if(ii(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=sn(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),rI(ge.view,W.moved),ii(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=sn(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);ii(E),s>0?ln(this).transition().duration(s).call(P,O,W,E):ln(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Cl(E),O=0;O<W;++O)U=S[O],ne=sn(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ma(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(ii(E),ie=0;ie<ee;++ie)O=W[ie],U=sn(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Cl(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=sn(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=ln(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Ba(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ba(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Ba(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Ba([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}const nf=Symbol("MiniMapSlots"),JC=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],ZC={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},QC=n.defineComponent({...ZC,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(nf),a=n.useAttrs(),r=n.toRef(()=>a.style??{});function l(m){t("click",m)}function s(m){t("dblclick",m)}function c(m){t("mouseenter",m)}function d(m){t("mousemove",m)}function u(m){t("mouseleave",m)}return(m,f)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,JC))],64)):n.createCommentVNode("",!0)}}),eS=["width","height","viewBox","aria-labelledby"],tS=["id"],nS=["d","fill","stroke","stroke-width"],oS={name:"MiniMap",compatConfig:{MODE:3}},iS=n.defineComponent({...oS,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:f,d3Zoom:p,getNodesInitialized:y}=He(),g=n.ref();n.provide(nf,o);const _=n.toRef(()=>{var ee;return e.width??((ee=i.style)==null?void 0:ee.width)??a}),b=n.toRef(()=>{var ee;return e.height??((ee=i.style)==null?void 0:ee.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),P=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=n.computed(()=>Ur(y.value.filter(ee=>!ee.hidden))),G=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),K=n.computed(()=>y.value&&y.value.length?y1(A.value,G.value):G.value),v=n.computed(()=>{const ee=K.value.width/_.value,ie=K.value.height/b.value;return Math.max(ee,ie)}),T=n.computed(()=>{const ee=v.value*_.value,ie=v.value*b.value,O=e.offsetScale*v.value;return{offset:O,x:K.value.x-(ee-K.value.width)/2-O,y:K.value.y-(ie-K.value.height)/2-O,width:ee+O*2,height:ie+O*2}}),H=n.computed(()=>!T.value.x||!T.value.y?"":`
49
+ M${T.value.x-T.value.offset},${T.value.y-T.value.offset}
50
+ h${T.value.width+T.value.offset*2}
51
+ v${T.value.height+T.value.offset*2}
52
+ h${-T.value.width-T.value.offset*2}z
53
+ M${G.value.x+e.maskBorderRadius},${G.value.y}
54
+ h${G.value.width-2*e.maskBorderRadius}
34
55
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
35
- v${q.value.height-2*e.maskBorderRadius}
56
+ v${G.value.height-2*e.maskBorderRadius}
36
57
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
37
- h${-(q.value.width-2*e.maskBorderRadius)}
58
+ h${-(G.value.width-2*e.maskBorderRadius)}
38
59
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
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=Dl.translate(re.x,re.y).scale(c.value.zoom),xe=m.value.constrain()(be,me,d.value);m.value.transform(p.value,xe)},se=DN().wheelDelta(he=>Qa(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(cd),{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,UN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(h),T=>(n.openBlock(),n.createBlock(PN,{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,HN)],8,zN))]),_:1},8,["position","class"]))}}),YN=["d"],WN=["cx","cy","onDblclick"],KN=["x","y","onPointerdown","onDblclick"],qN=Le(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=De(),i=n.inject(gl),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}=Bd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),g=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(p.value,h.value,f.value,m.value,b.value):oa(p.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?na(p.value,h.value,f.value,m.value,b.value):la(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,YN),(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,WN))),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,KN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),XN=["data-theme"],jN={key:0,class:"em-ctx__sep",role:"separator"},ZN={key:1,class:"em-ctx__swatches"},JN={class:"em-ctx__swatches-label"},QN={class:"em-ctx__chips"},e$=["onClick"],t$=["title","onClick"],n$=["disabled","onClick"],o$={class:"em-ctx__icon"},i$={class:"em-ctx__caption"},a$=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",jN)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",ZN,[n.createElementVNode("span",JN,n.toDisplayString(b.caption),1),n.createElementVNode("div",QN,[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,e$),(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,t$))),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",o$,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",i$,n.toDisplayString(b.caption),1)],10,n$))],64))),128))],36)],8,XN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Ll=[".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 l$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function r$(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 Qi(e,t){const o=[];for(const i of e.querySelectorAll("*"))l$(i)&&(i.closest(Ll)||Fn(i)&&o.push(...r$(i,t)));return o}function Ro(e){return Math.round(e*100)/100}function s$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Ll)||!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 c$(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 Cu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Ll)||!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 Pl(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 d$(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);Pl(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:Qi(b,o)})}else if(m.type==="note"){const g={...Vo(b,o),texts:Qi(b,o),lines:Cu(b,b,o)};Pl(s,g),l.push(g)}else{const g=Vo(b,o);Pl(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:Qi(b,o),lines:Cu(b,b,o),icons:s$(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=c$(m);r.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:Qi(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 Ru(e){return jl(d$(e))}function Vu(e,t="diagram.svg"){const o=Ru(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 zl="nc:",Au=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(Ti,d);const u=n.ref(null);n.provide(_d,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`${zl}${S}:${D}`}function b(S){if(!S.startsWith(zl))return null;const[D,I]=S.slice(zl.length).split(":");return D&&I?{noteRef:D,targetRef:I}:null}n.provide(gl,{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{Vu(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:()=>Vi(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:JI=>i.setAttributeSwatches(D.id,We,JI)},{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:()=>Vi(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"?ud(Qe((D=S.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":ud(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(A0),{"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(vd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"node-entity":n.withCtx(I=>[n.createVNode(wd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"node-note":n.withCtx(I=>[n.createVNode(kd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"edge-association":n.withCtx(I=>[n.createVNode(Dd,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),"edge-note-connection":n.withCtx(I=>[n.createVNode(qN,n.normalizeProps(n.guardReactiveProps(I)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Dw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(sv),{"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(GN),{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(a$,{ref_key:"menuRef",ref:Y},null,512)],2))}}),[["__scopeId","data-v-eaeafa69"]]),u$={class:"em-explorer em-scroll-overlay"},f$={class:"em-explorer__rows"},m$=["data-key","onClick","onDblclick"],p$=["onClick"],h$=["title"],y$={class:"em-key-slot"},g$={class:"em-key-slot"},b$={class:"em-explorer__label"},Tu=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=ua(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=er(R,i.state.logical.associations),oe=ua(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&&Vi(a,i,_.selectId)}return(_,N)=>(n.openBlock(),n.createElementBlock("section",u$,[n.createElementVNode("div",f$,[(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,p$),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",y$,[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",g$,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,h$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",b$,n.toDisplayString(y.label),1)],46,m$))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),_$={class:"em-text-preview"},w$={class:"em-text-preview__pre"},v$={class:"em-text-preview__actions"},k$=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",_$,[n.createElementVNode("pre",w$,n.toDisplayString(t.text),1),n.createElementVNode("div",v$,[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"]]),E$={class:"em-toolbar"},N$={class:"em-toolbar__mode"},Mu=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:k$,bind:{text:ql(i.state.logical)}})}return(p,m)=>(n.openBlock(),n.createElementBlock("div",E$,[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",N$,[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"]]),$$=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"]]),x$=["disabled"],I$={class:"em-panel__sub"},S$={class:"em-nav"},C$={key:0,class:"em-nav__divider","aria-hidden":"true"},R$={key:1},V$=["onClick","onKeydown"],A$={class:"em-nav__name"},T$=["title"],M$={key:0,class:"em-panel__note"},B$=["data-attr-block"],D$={class:"em-attr__row"},O$={key:0,class:"em-attr__row"},L$={class:"em-attr__row"},P$={class:"em-attr__row"},z$={class:"em-attr__flags"},U$={class:"em-attr__pii"},H$={class:"em-attr__pii"},F$={class:"em-attr__pii"},G$={key:0,class:"em-attr__pii em-attr__codetop"},Y$={class:"em-multilang"},W$={key:2,class:"em-embed-cols"},K$={class:"em-embed-col__label"},q$={class:"em-attr__row"},X$={class:"em-attr__row"},j$={key:0,class:"em-embed-upd"},Z$={class:"em-embed-upd"},J$={class:"em-embed-upd"},Q$={class:"em-swatch__row em-attr__swatch"},ex=["onClick"],tx=["title","onClick"],nx={key:0,class:"em-attr__swatch-hint"},ea="__OWN__",ox=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[ea,...S.value.map(A=>A.modelId)]}function I(A){if(A===ea)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)??ea}function ie(A,Z,z){k(A,Z,{sharedColumnRef:z===ea?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",I$,[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",S$,[(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",C$,[...Z[0]||(Z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",R$,[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",A$,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,T$)],42,V$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",M$," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):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",D$,[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(Ql)(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",O$,[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",W$,[(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",K$,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",q$,[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",X$,[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",j$,[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",Z$,[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",J$,[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",L$,[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",P$,[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(Zl)(((Oe=z.dbAttrs[0])==null?void 0:Oe.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(sa),"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",z$,[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",U$,[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",H$,[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",F$,[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",G$,[Z[4]||(Z[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(pd,{"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",Y$,[Z[6]||(Z[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ml,{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",Q$,[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,ex),(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,tx))),128)),_(z)?(n.openBlock(),n.createElementBlock("span",nx,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,B$)}),128))],8,x$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-5b6c4296"]]),ix=["disabled"],ax={class:"em-panel__sub-label"},lx={class:"em-attr__row"},rx={class:"em-field em-idx-params"},sx=["value","onChange"],cx=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",ax,[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",lx,[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",rx,[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,sx)])]))),128)):n.createCommentVNode("",!0)],8,ix)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),dx=["disabled"],ux={class:"em-panel__sub-label"},fx={class:"em-attr__row"},mx={class:"em-attr__row"},px={class:"em-multilang"},hx={class:"em-attr__pii"},yx={class:"em-swatch__row em-attr__swatch"},gx=["onClick"],bx=["title","onClick"],_x=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:hd,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",ux,[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",fx,[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",mx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:F.sourceCode?"본문 편집 ●":"본문 편집",onClick:q=>N(F)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",px,[$[2]||($[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ml,{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",hx,[$[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",yx,[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,gx),(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,bx))),128))])]))),128)):n.createCommentVNode("",!0)],8,dx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),wx={class:"em-panel__head"},vx={class:"em-panel__head-row"},kx={class:"em-panel__context"},Ex={key:0,class:"em-panel__lock"},Nx=["disabled"],$x={key:0,class:"em-panel__note"},xx={key:1,class:"em-panel__note"},Ix={key:2,class:"em-jpa"},Sx={class:"em-field"},Cx={class:"em-field"},Rx={key:0,class:"em-field"},Vx={class:"em-panel__sub"},Ax={class:"em-field"},Tx={class:"em-jpa"},Mx={key:0,class:"em-panel__note"},Bx={class:"em-jpa"},Dx={class:"em-field"},Ox={key:0,class:"em-panel__note"},Lx={class:"em-field"},Px={class:"em-multilang"},zx={class:"em-field"},Ux=["value"],Hx={class:"em-field"},Fx={class:"em-swatch"},Gx={class:"em-swatch__row"},Yx=["title","onClick"],Wx={class:"em-panel__note"},Kx={class:"em-field"},qx=["value"],Xx={class:"em-swatch"},jx={class:"em-swatch__row"},Zx=["title","onClick"],Bu=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",wx,[n.createElementVNode("div",vx,[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",kx,n.toDisplayString($.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",Ex,[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(fd,{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(ox,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(cx,{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(_x,{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",$x,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):T.value?(n.openBlock(),n.createElementBlock("p",xx,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),T.value?(n.openBlock(),n.createElementBlock("fieldset",Ix,[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",Sx,[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",Cx,[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",Rx,[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",Vx,n.toDisplayString(k)+" → "+n.toDisplayString(g.value[k].entityRef),1),n.createElementVNode("label",Ax,[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",Tx,[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",Mx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",Bx,[C[24]||(C[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",Dx,[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",Ox,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",Lx,[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",Px,[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",zx,[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,Ux)]),n.createElementVNode("label",Hx,[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",Fx,[C[28]||(C[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Gx,[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,Yx))),128))])]),n.createElementVNode("p",Wx,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",Kx,[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,qx)]),n.createElementVNode("fieldset",Xx,[C[30]||(C[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",jx,[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,Zx))),128))])])],64)):n.createCommentVNode("",!0)],8,Nx)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),Jx={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function Qx(e){const t=e.split("-")[1];return t?Jx[t]??t:e}function eI(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const tI=["title"],nI=["title","onClick"],oI={key:0,class:"em-validation__body"},iI={class:"em-validation__opt"},aI={key:0,class:"em-validation__empty"},lI={key:1,class:"em-validation__empty"},rI={key:2,class:"em-validation__list"},sI=["onClick"],cI={class:"em-validation__item-msg"},dI={key:0,class:"em-validation__item-entity"},uI=["title"],fI=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=eI(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:Qx(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,tI),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,nI)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",oI,[n.createElementVNode("label",iI,[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",aI,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",lI," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",rI,[(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",cI,[N?(n.openBlock(),n.createElementBlock("span",dI,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,uI)],10,sI))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),mI={class:"em-history"},pI={class:"em-history__head"},hI={class:"em-history__title"},yI={class:"em-history__head-actions"},gI=["disabled"],bI={class:"em-history__filters"},_I={class:"em-history__filter"},wI={class:"em-history__body"},vI={key:0,class:"em-history__empty"},kI={key:1,class:"em-history__empty is-error"},EI={key:2,class:"em-history__empty"},NI={key:3,class:"em-history__list"},$I=["onClick"],xI={class:"em-history__summary"},II={class:"em-history__seq"},SI={class:"em-history__gmeta"},CI={class:"em-history__who"},RI={key:0,class:"em-history__time"},VI={key:1,class:"em-history__restored-from"},AI={key:0,class:"em-history__detail"},TI={class:"em-history__action-head"},MI={class:"em-history__action-name"},BI={key:0,class:"em-history__fields"},DI={class:"em-history__fname"},OI={key:0,class:"em-history__old"},LI={class:"em-history__val"},PI={key:1,class:"em-history__restore"},zI=["disabled","onClick"],UI=["disabled"],HI=["onClick"],FI=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(()=>lr(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",mI,[n.createElementVNode("header",pI,[n.createElementVNode("div",hI,[n.createVNode(Ve,{name:"undo",size:15}),J[4]||(J[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",yI,[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,gI),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",bI,[n.createElementVNode("label",_I,[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",wI,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",vI,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",kI,n.toDisplayString(s.value),1)):G.value.length===0?(n.openBlock(),n.createElementBlock("p",EI,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",NI,[(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",xI,n.toDisplayString(de(se)),1),n.createElementVNode("span",II,"#"+n.toDisplayString(se.seq),1)],8,$I),n.createElementVNode("div",SI,[n.createElementVNode("span",CI,n.toDisplayString(R(se)),1),se.ts?(n.openBlock(),n.createElementBlock("span",RI,n.toDisplayString(v(se.ts)),1)):n.createCommentVNode("",!0),se.kind==="restore"&&se.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",VI,"← #"+n.toDisplayString(se.restoredFromSeq),1)):n.createCommentVNode("",!0)]),B.value.has(se.seq)?(n.openBlock(),n.createElementBlock("div",AI,[(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",TI,[n.createVNode(Ve,{name:_[he.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",MI,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",BI,[(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",DI,n.toDisplayString(re.field),1),re.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",OI,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",LI,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",PI,[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,zI),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:P.value,onClick:J[3]||(J[3]=he=>E.value=null)},"취소",8,UI)],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,HI))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function GI(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 Du(e){const t=n.ref(GI(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 YI={class:"em-modeler"},WI={class:"em-modeler__body"},KI={class:"em-drawer__inner"},qI={class:"em-drawer__head"},XI={class:"em-drawer__actions"},jI=["title"],ZI=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}=Du({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Du({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",YI,[n.createVNode(Mu,{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",WI,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",KI,[n.createElementVNode("header",qI,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",XI,[(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,jI)):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(Tu,{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(Au,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Bu,{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(FI,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(fI,{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=am,Ne.AssociationEdge=Dd,Ne.CUSTOM_TYPE_VALUE=Ot,Ne.CommandStack=ya,Ne.DEFAULT_JAVA_TYPE=ca,Ne.DiagramCanvas=Au,Ne.DiagramExplorer=Tu,Ne.EDITOR=hn,Ne.EditModeToggle=$$,Ne.EditorToolbar=Mu,Ne.EntityModeler=ZI,Ne.EntityNode=wd,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=vd,Ne.JAVA_TYPES=da,Ne.NoteNode=kd,Ne.OpSyncAdapter=Wr,Ne.PHYSICAL_NAME_MAX_LENGTH=fa,Ne.PropertyPanel=Bu,Ne.RevCache=Yr,Ne.SELECTABLE_JAVA_TYPES=Jl,Ne.SYMBOLIC_OP_KINDS=Kr,Ne.SYMBOLIC_OP_SCHEMA=is,Ne.anchoredEdgePoint=aa,Ne.buildAgentBatch=lm,Ne.buildDiagramSvg=Ru,Ne.buildOrthogonalPath=ta,Ne.buildSelfLoopPath=Fl,Ne.buildStraightPath=oa,Ne.commands=Cf,Ne.computeAutoLayout=Gl,Ne.createEditorController=z_,Ne.displayLabel=Oo,Ne.emptyState=yd,Ne.entityModelToText=ql,Ne.estimateEntityHeight=Wl,Ne.exportDiagramSvg=Vu,Ne.fromPersisted=_m,Ne.indexColumnsByModelId=Wn,Ne.javaTypeLabel=vn,Ne.migrateLegacyMoney=df,Ne.newId=Te,Ne.orthogonalMidpoints=na,Ne.packEntityBoxes=Fu,Ne.physicalNameWarning=zo,Ne.projectActionLog=lr,Ne.projectEntityAudit=ir,Ne.projectFieldAudit=Lt,Ne.rectExitPoint=ia,Ne.renderDiagramSvg=jl,Ne.resolveDiagram=Ul,Ne.resolveSharedColumn=Po,Ne.resolveSymbolicOps=Xf,Ne.restoreDeepEqual=kn,Ne.segmentMidpoints=la,Ne.sideDir=Gn,Ne.synthesizeRestoreOps=wf,Ne.toPersisted=Tm,Ne.toPersistedV2=Mm,Ne.validateModel=nr,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
60
+ v${-(G.value.height-2*e.maskBorderRadius)}
61
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(ee=>{if(g.value){const ie=ln(g.value),O=ce=>{if(ce.sourceEvent.type!=="wheel"||!f.value||!p.value)return;const ge=ce.sourceEvent.ctrlKey&&Yo()?10:1,se=-ce.sourceEvent.deltaY*(ce.sourceEvent.deltaMode===1?.05:ce.sourceEvent.deltaMode?1:.002)*e.zoomStep,pe=c.value.zoom*2**(se*ge);p.value.scaleTo(f.value,pe)},U=ce=>{if(ce.sourceEvent.type!=="mousemove"||!f.value||!p.value)return;const ge=v.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-ce.sourceEvent.movementX*ge,y:c.value.y-ce.sourceEvent.movementY*ge},pe=[[0,0],[u.value.width,u.value.height]],be=Il.translate(se.x,se.y).scale(c.value.zoom),xe=p.value.constrain()(be,pe,d.value);p.value.transform(f.value,xe)},ne=XC().wheelDelta(ce=>Fr(ce)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?O:()=>{});ie.call(ne),ee(()=>{ie.on("zoom",null)})}},{flush:"post"});function C(ee){const[ie,O]=sn(ee);t("click",{event:ee,position:{x:ie,y:O}})}function ae(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeClick(O),t("nodeClick",O)}function E(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeDoubleClick(O),t("nodeDblclick",O)}function Y(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseEnter(O),t("nodeMouseenter",O)}function S(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseMove(O),t("nodeMousemove",O)}function W(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseLeave(O),t("nodeMouseleave",O)}return(ee,ie)=>(n.openBlock(),n.createBlock(n.unref(Tu),{position:ee.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:ee.pannable,zoomable:ee.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:_.value,height:b.value,viewBox:[T.value.x,T.value.y,T.value.width,T.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(l)}`,onClick:C},[ee.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(l)}`},n.toDisplayString(ee.ariaLabel),9,tS)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),O=>(n.openBlock(),n.createBlock(QC,{id:O.id,key:O.id,f:"",position:O.computedPosition,dimensions:O.dimensions,selected:O.selected,dragging:O.dragging,style:n.normalizeStyle(O.style),class:n.normalizeClass(P.value(O)),color:h.value(O),"border-radius":ee.nodeBorderRadius,"stroke-color":k.value(O),"stroke-width":ee.nodeStrokeWidth,"shape-rendering":n.unref(N),type:O.type,hidden:O.hidden,onClick:U=>ae(U,O),onDblclick:U=>E(U,O),onMouseenter:U=>Y(U,O),onMousemove:U=>S(U,O),onMouseleave:U=>W(U,O)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:H.value,fill:ee.maskColor,stroke:ee.maskStrokeColor,"stroke-width":ee.maskStrokeWidth,"fill-rule":"evenodd"},null,8,nS)],8,eS))]),_:1},8,["position","class"]))}}),aS=["d"],rS=["cx","cy","onDblclick"],lS=["x","y","onPointerdown","onDblclick"],sS=Ge(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(so,null),s=n.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(t.data.targetRef)||!l.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),m=n.computed(()=>c.value.map((K,v)=>v===d.value?u.value:K)),{source:f,target:p,sourceSide:y,targetSide:g}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>m.value}),_=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?La(f.value,y.value,m.value,p.value,g.value):za(f.value,m.value,p.value)),b=n.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(f.value,y.value,m.value,p.value,g.value):Ha(f.value,m.value,p.value).map((K,v)=>({point:K,segIndex:v})):[]),N=n.computed(()=>r.value?m.value:[]);function h(K,v){d.value=K,u.value={...c.value[K]},v.target.setPointerCapture(v.pointerId),v.stopPropagation()}function k(K){if(d.value<0)return;const v=o({x:K.clientX,y:K.clientY});u.value={x:v.x,y:v.y}}function P(K){var v,T;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(T=(v=K.target).releasePointerCapture)==null||T.call(v,K.pointerId)}function A(K,v){v.stopPropagation(),i==null||i.removePoint(t.id,K)}function G(K,v){if(!i)return;const T=o({x:v.clientX,y:v.clientY});i.insertPoint(t.id,K,{x:T.x,y:T.y})}return(K,v)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,aS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(T,H)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${H}`,cx:T.point.x,cy:T.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(C=>G(T.segIndex,C),["stop"])},null,42,rS))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(T,H)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${H}`,x:T.x-5,y:T.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:C=>h(H,C),onPointermove:k,onPointerup:P,onDblclick:C=>A(H,C)},null,42,lS))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),cS=["data-theme"],dS={key:0,class:"em-ctx__sep",role:"separator"},uS={key:1,class:"em-ctx__swatches"},mS={class:"em-ctx__swatches-label"},fS={class:"em-ctx__chips"},pS=["title","onClick"],hS=["title","onClick"],yS=["disabled","onClick"],gS={class:"em-ctx__icon"},bS={class:"em-ctx__caption"},_S=Ge(n.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:t}){const o=e,i=(g,_)=>Ct(o.locale??"ko",g,_),a=n.ref(!1),r=n.ref([]),l=n.ref(void 0),s=n.ref(null),c=n.reactive({x:0,y:0}),d=8;async function u(g,_){var h;r.value=_,l.value=(h=g.target)!=null&&h.closest('[data-theme="dark"]')?"dark":void 0,c.x=g.clientX,c.y=g.clientY,a.value=!0,window.addEventListener("keydown",f),window.addEventListener("resize",m),await n.nextTick();const b=s.value;if(!b)return;const N=b.getBoundingClientRect();c.x+N.width>window.innerWidth-d&&(c.x=Math.max(d,window.innerWidth-d-N.width)),c.y+N.height>window.innerHeight-d&&(c.y=Math.max(d,window.innerHeight-d-N.height))}function m(){a.value&&(a.value=!1,r.value=[],window.removeEventListener("keydown",f),window.removeEventListener("resize",m))}function f(g){g.key==="Escape"&&(g.stopPropagation(),m())}function p(g){g.disabled||(g.handler(),m())}function y(g,_){g.onPick(_),m()}return n.onBeforeUnmount(m),t({open:u,close:m}),(g,_)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:m,onContextmenu:n.withModifiers(m,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:n.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:_[0]||(_[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,(b,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",dS)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",uS,[n.createElementVNode("span",mS,n.toDisplayString(b.caption),1),n.createElementVNode("div",fS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:i("em.swatch.none"),onClick:h=>y(b,null)},null,10,pS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),h=>(n.openBlock(),n.createElementBlock("button",{key:h,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===h}]),style:n.normalizeStyle({background:n.unref(ao)(h)}),title:n.unref(io)(h),onClick:k=>y(b,h)},null,14,hS))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:h=>p(b)},[n.createElementVNode("span",gS,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",bS,n.toDisplayString(b.caption),1)],10,yS))],64))),128))],36)],8,cS)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b8cdb1f"]]),Sl=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function fo(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function kS(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function ES(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const g=t(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,f=0;const p=()=>{const y=d.trim();if(y){const g=t(m,(u+f)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(p(),u=g.top,m=g.left,f=g.bottom,d=s[y]):(d+=s[y],f=Math.max(f,g.bottom))}return p(),c}function Da(e,t){const o=[];for(const i of e.querySelectorAll("*"))kS(i)&&(i.closest(Sl)||fo(i)&&o.push(...ES(i,t)));return o}function ai(e){return Math.round(e*100)/100}function NS(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Sl)||!fo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=t(a.left,a.top),l=t(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ai(r.x)}" y="${ai(r.y)}" width="${ai(l.x-r.x)}" height="${ai(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function wS(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!fo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>ai(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return t}function of(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Sl)||!fo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function ri(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),r=t(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function $l(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function vS(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!fo(y))continue;const g=y.firstElementChild;if(g)if(p.type==="group"){const _=ri(g,o);$l(s,_),i.push({..._,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...ri(b,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o)})}else if(p.type==="note"){const _={...ri(g,o),texts:Da(g,o),lines:of(g,g,o)};$l(s,_),r.push(_)}else{const _=ri(g,o);$l(s,_);const b=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const h=ri(N,o);a.push({x:_.x,y:_.y,w:_.w,h:h.y+h.h-_.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o),lines:of(g,g,o),icons:NS(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!fo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),b=_.strokeDasharray,N=wS(p);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Da(p,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Rl(e){return ls(vS(e))}function af(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function rf(e,t="diagram.svg"){const o=Rl(e);af(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function xS(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function lf(e,t="diagram.png",o=2){const i=Rl(e),{w:a,h:r}=xS(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,f)=>{s.onload=()=>m(),s.onerror=()=>f(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");af(u,t)}finally{URL.revokeObjectURL(l)}}const IS={class:"em-shortcuts"},CS={class:"em-shortcuts__title"},SS={class:"em-shortcuts__keys"},$S={class:"em-shortcuts__kbd"},RS={key:0,class:"em-shortcuts__plus"},AS={class:"em-shortcuts__desc"},TS={class:"em-shortcuts__actions"},sf=Ge(n.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(s,c)=>Ct(t.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=n.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.shortcuts.title")},{default:n.withCtx(()=>[n.createElementVNode("div",IS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",CS,n.toDisplayString(d.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.items,u=>(n.openBlock(),n.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",SS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.keys,(m,f)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:m+f},[n.createElementVNode("kbd",$S,n.toDisplayString(m),1),f<u.keys.length-1?(n.openBlock(),n.createElementBlock("span",RS,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",AS,n.toDisplayString(u.desc),1)]))),128))]))),128)),n.createElementVNode("div",TS,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-af88f86f"]]);function po(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function VS(e,t){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(t);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const MS={class:"em-cmdk",role:"dialog","aria-modal":"true"},BS=["placeholder"],DS={class:"em-cmdk__results"},OS={class:"em-cmdk__section"},LS=["onMouseenter","onClick"],PS={class:"em-cmdk__label"},zS={key:0,class:"em-cmdk__tag"},US={key:1,class:"em-cmdk__sub"},FS={class:"em-cmdk__section"},HS=["onMouseenter","onClick"],GS={class:"em-cmdk__label"},jS={key:1,class:"em-cmdk__empty"},KS=Ge(n.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref(""),l=n.ref(0),s=n.ref(null),c=n.computed(()=>a.userLanguage.value),d=n.computed(()=>{const h=c.value,k=a.state.logical.entities.map(A=>{var G,K,v,T,H,C;return{type:"goto",kind:"entity",id:A.modelId,label:((K=(G=A.table)==null?void 0:G.logicalName)==null?void 0:K[h])||A.name,sub:(v=A.table)==null?void 0:v.physicalName,match:po(A.name,(H=(T=A.table)==null?void 0:T.logicalName)==null?void 0:H[h],(C=A.table)==null?void 0:C.physicalName)??""}}),P=a.state.logical.groups.map(A=>{var G,K,v,T;return{type:"goto",kind:"group",id:A.modelId,label:((G=A.name)==null?void 0:G[h])||((K=A.name)==null?void 0:K.ko)||A.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:po((v=A.name)==null?void 0:v[h],(T=A.name)==null?void 0:T.ko,A.packageName)??""}});return[...k,...P]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=n.computed(()=>{const h=[];a.editable.value&&(h.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),h.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),h.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),h.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),h.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),h.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),h.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),h.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const k of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])h.push({type:"action",id:`dm-${k}`,label:a.t(u[k]),run:()=>a.displayMode.value=k});return h});function f(h,k){return h.label.toLowerCase().includes(k)}const p=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?d.value.filter(k=>k.match.includes(h)):d.value}),y=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?m.value.filter(k=>f(k,h)):m.value}),g=n.computed(()=>[...p.value,...y.value]);n.watch([p,y],()=>{l.value=0});function _(h){return g.value.indexOf(h)}function b(h){if(h.type==="goto")a.selection.value={kind:h.kind,id:h.id},a.requestFocus(h.id);else{if(h.disabled)return;h.run()}i("close")}function N(h){if(h.key==="Escape"){i("close"),h.preventDefault();return}if(h.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),h.preventDefault();return}if(h.key==="ArrowUp"){l.value=Math.max(l.value-1,0),h.preventDefault();return}if(h.key==="Enter"){const k=g.value[l.value];k&&b(k),h.preventDefault()}}return n.nextTick(()=>{var h;return(h=s.value)==null?void 0:h.focus()}),(h,k)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:k[1]||(k[1]=n.withModifiers(P=>i("close"),["self"]))},[n.createElementVNode("div",MS,[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":k[0]||(k[0]=P=>r.value=P),class:"em-cmdk__input",type:"text",placeholder:n.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,BS),[[n.vModelText,r.value]]),n.createElementVNode("div",DS,[g.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("div",OS,n.toDisplayString(n.unref(a).t("em.cmd.sectionGoto")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",PS,n.toDisplayString(P.label),1),P.tag?(n.openBlock(),n.createElementBlock("span",zS,n.toDisplayString(P.tag),1)):P.sub?(n.openBlock(),n.createElementBlock("span",US,n.toDisplayString(P.sub),1)):n.createCommentVNode("",!0)],42,LS))),128))],64)):n.createCommentVNode("",!0),y.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",FS,n.toDisplayString(n.unref(a).t("em.cmd.sectionActions")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value,"is-disabled":P.disabled}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",GS,n.toDisplayString(P.label),1)],42,HS))),128))],64)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock("div",jS,n.toDisplayString(n.unref(a).t("em.cmd.empty")),1))])])],32)]))}}),[["__scopeId","data-v-a5a7d1c2"]]);function YS(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const WS={key:0,class:"em-canvas__empty","aria-hidden":"true"},qS={class:"em-canvas__empty-title"},XS=["innerHTML"],JS=["innerHTML"],ZS={key:1,class:"em-canvas__empty-title"},QS={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},e$={class:"em-conflict-banner__body"},t$={class:"em-conflict-banner__title"},n$={class:"em-conflict-banner__detail"},o$={key:0,class:"em-toast",role:"status","aria-live":"polite"},Al="nc:",cf=Ge(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.ref(!1),l=n.ref(null);let s;n.watch(()=>i.notice.value,z=>{z&&(l.value=z.text,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>s&&clearTimeout(s));const c=n.computed(()=>YS(i.opConflict.value)),d=n.ref(!1),u=n.ref(!1),m={x:0,y:0};function f(z){m.x=z.clientX,m.y=z.clientY}const p=n.ref(null);n.provide(ya,p);const y=n.ref(null);n.provide(Yu,y);const g=n.ref(null),_=n.computed(()=>{const z=g.value,q=new Set;if(!z)return q;if(z.kind==="entity")q.add(z.id);else if(z.kind==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===z.id);for(const Ce of(ue==null?void 0:ue.group.memberEntityRefs)??[])q.add(Ce)}return q}),b=n.computed(()=>{const z=g.value,q=new Set(_.value),ue=new Set,Ce=new Set;if(!z)return{related:q,edges:ue,notes:Ce};if(z.kind==="note"){Ce.add(z.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===z.id&&q.add(Oe.targetRef);return{related:q,edges:ue,notes:Ce}}const Be=_.value;if(!Be.size)return{related:q,edges:ue,notes:Ce};for(const Oe of i.resolved.value.associations){const{end1:he,end2:le}=Oe.association;(Be.has(he.entityRef)||Be.has(le.entityRef))&&(ue.add(Oe.association.modelId),q.add(he.entityRef),q.add(le.entityRef))}for(const Oe of i.resolved.value.noteConnections)q.has(Oe.targetRef)&&Ce.add(Oe.noteRef);return{related:q,edges:ue,notes:Ce}});n.provide(so,{source:g,active:n.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var z;return((z=g.value)==null?void 0:z.kind)==="group"?g.value.id:null}),setEntityHover:z=>{y.value||u.value||(g.value=z?{kind:"entity",id:z}:null)},setGroupHover:z=>{y.value||u.value||(g.value=z?{kind:"group",id:z}:null)},setNoteHover:z=>{y.value||u.value||(g.value=z?{kind:"note",id:z}:null)}}),n.provide(An,i);function N(z,q){return`${Al}${z}:${q}`}function h(z){if(!z.startsWith(Al))return null;const[q,ue]=z.slice(Al.length).split(":");return q&&ue?{noteRef:q,targetRef:ue}:null}n.provide(ll,{points:z=>{var ue,Ce;const q=h(z);return q?((ue=i.resolved.value.noteConnections.find(Be=>Be.noteRef===q.noteRef&&Be.targetRef===q.targetRef))==null?void 0:ue.waypoints)??[]:((Ce=i.resolved.value.associations.find(Be=>Be.association.modelId===z))==null?void 0:Ce.waypoints)??[]},movePoint:(z,q,ue)=>{const Ce=h(z);Ce?i.moveNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.moveWaypoint(z,q,ue)},insertPoint:(z,q,ue)=>{const Ce=h(z);Ce?i.addNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.addWaypoint(z,q,ue)},removePoint:(z,q)=>{const ue=h(z);ue?i.removeNoteConnectionWaypoint(ue.noteRef,ue.targetRef,q):i.removeWaypoint(z,q)}});const k=He(),{nodes:P,edges:A,findNode:G,findEdge:K,addNodes:v,addEdges:T,removeNodes:H,removeEdges:C,fitView:ae,setCenter:E,getViewport:Y,screenToFlowCoordinate:S,getSelectedNodes:W,updateNodeInternals:ee}=k,ie=n.ref(!1);async function O(z){ie.value=!0,await n.nextTick(),await new Promise(q=>requestAnimationFrame(()=>q(null)));try{return await z()}finally{ie.value=!1}}function U(){return O(()=>rf(k))}function ne(){return O(()=>lf(k))}t({exportSvg:U,exportPng:ne});const ce=n.computed(()=>i.resolved.value.entities.length===0);function ge(){const z=Y(),{width:q,height:ue}=k.dimensions.value;return{x:(q/2-z.x)/z.zoom,y:(ue/2-z.y)/z.zoom}}function se(){const z=ge();i.addEntity("NewEntity",{x:z.x,y:z.y})}function pe(){const z=ge();i.addNote("메모",{x:z.x,y:z.y})}function be(z){for(const q of i.resolved.value.groups){const{location:ue,size:Ce}=q.geo;if(z.x>=ue.x&&z.x<=ue.x+Ce.width&&z.y>=ue.y&&z.y<=ue.y+Ce.height)return q.group.modelId}return null}function xe(){const z=i.resolved.value,q=new Map(z.groups.map(he=>[he.group.modelId,he.geo])),ue=new Set(z.groups.map(he=>he.group.modelId)),Ce=new Set([...ue,...z.entities.map(he=>he.entity.modelId),...z.notes.map(he=>he.note.modelId)]);for(const he of[...P.value])Ce.has(he.id)||H([he.id]);for(const he of z.groups){const le=he.group.modelId,Pe={width:`${he.geo.size.width}px`,height:`${he.geo.size.height}px`},Ke={group:he.group,style:he.style,locked:he.locked},st=he.locked?!1:void 0,Ze=G(le);Ze?(Ze.position={...he.geo.location},Ze.data=Ke,Ze.style=Pe,Ze.draggable=st):v([{id:le,type:"group",position:{...he.geo.location},draggable:st,style:Pe,data:Ke}])}for(const he of z.entities){const le=he.entity.modelId,Pe=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,Ke={entity:he.entity,displayMode:i.displayMode.value,collapsed:he.collapsed,locked:he.locked,groupRef:Pe,size:he.geo.size,style:he.style,attributeStyles:he.attributeStyles,operationStyles:he.operationStyles},st=he.locked?!1:void 0,Ze=Pe?q.get(Pe):void 0,pt=Ze?{x:he.geo.location.x-Ze.location.x,y:he.geo.location.y-Ze.location.y}:{...he.geo.location},nt=G(le);nt?(nt.position=pt,nt.data=Ke,nt.parentNode=Pe,nt.draggable=st):v([{id:le,type:"entity",position:pt,parentNode:Pe,draggable:st,data:Ke}])}for(const he of z.notes){const le=he.note,Pe=le.modelId,Ke=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,st={note:le,groupRef:Ke},Ze={width:`${le.geo.size.width}px`,height:`${le.geo.size.height}px`},pt=Ke?q.get(Ke):void 0,nt=pt?{x:le.geo.location.x-pt.location.x,y:le.geo.location.y-pt.location.y}:{...le.geo.location},at=G(Pe);at?(at.position=nt,at.data=st,at.style=Ze,at.parentNode=Ke):v([{id:Pe,type:"note",position:nt,parentNode:Ke,style:Ze,data:st}])}const Be=new Map(z.associations.map(he=>[he.association.modelId,he])),Oe=new Set(z.noteConnections.map(he=>N(he.noteRef,he.targetRef)));for(const he of[...A.value])!Be.has(he.id)&&!Oe.has(he.id)&&C([he.id]);for(const[he,le]of Be){const Pe={id:he,type:"association",source:le.association.end1.entityRef,target:le.association.end2.entityRef,sourceHandle:le.sourceColumnRef?`r:${le.sourceColumnRef}`:void 0,targetHandle:le.targetColumnRef?`l:${le.targetColumnRef}`:void 0,data:{association:le.association,sourceColumnRef:le.sourceColumnRef,targetColumnRef:le.targetColumnRef}},Ke=K(he);Ke?(Ke.data=Pe.data,Ke.sourceHandle=Pe.sourceHandle,Ke.targetHandle=Pe.targetHandle):T([Pe])}for(const he of z.noteConnections){const le=N(he.noteRef,he.targetRef),Pe={noteRef:he.noteRef,targetRef:he.targetRef},Ke=K(le);Ke?Ke.data=Pe:T([{id:le,type:"note-connection",source:he.noteRef,target:he.targetRef,data:Pe}])}Te()}function Te(){n.nextTick(()=>requestAnimationFrame(()=>ee()))}function Ae(){const z=W.value.map(ue=>ue.id);if(z.length)return z;const q=i.selection.value;return q&&(q.kind==="entity"||q.kind==="note"||q.kind==="group")?[q.id]:[]}function fe(){return W.value.filter(z=>z.type==="entity").map(z=>z.id)}function ke(){return W.value.filter(z=>z.type==="group").map(z=>z.id)}function we(z){var q;return[...((q=i.state.logical.groups.find(ue=>ue.modelId===z))==null?void 0:q.memberEntityRefs)??[]]}function j(){const z=ke().flatMap(we);return[...new Set([...fe(),...z])]}function L(){return ke().length>0||fe().length>1}function x(){L()?i.copy(j()):i.copy()}async function R(z){if(!z.length)return;await n.nextTick();const q=W.value;q.length&&k.removeSelectedNodes(q);const ue=z.map(Ce=>G(Ce)).filter(Ce=>!!Ce);ue.length&&k.addSelectedNodes(ue)}function V(z){if(L()&&fe().includes(z)){const q=j();return{caption:i.t("em.ctx.copyN",{n:q.length}),icon:"copy",handler:()=>i.copy(q)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:z},i.copy()}}}function Q(z){var Be;const q=z.target;if(q&&(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable))return;if(z.key==="?"){a.openModal({component:sf,bind:{locale:i.uiLocale.value}}),z.preventDefault();return}if((z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"){r.value=!0,z.preventDefault();return}if(!i.editable.value){(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="c"&&(x(),z.preventDefault());return}if(z.key==="Delete"||z.key==="Backspace"){i.deleteSelection()&&z.preventDefault();return}if(z.key==="ArrowUp"||z.key==="ArrowDown"||z.key==="ArrowLeft"||z.key==="ArrowRight"){if(((Be=i.selection.value)==null?void 0:Be.kind)==="attribute"){if(z.key==="ArrowUp"||z.key==="ArrowDown"){const Pe=z.key==="ArrowDown"?1:-1;(z.altKey?i.nudgeSelectedAttributes(Pe):i.moveAttributeFocus(Pe))&&z.preventDefault()}return}const Oe=z.shiftKey?10:1,he=z.key==="ArrowLeft"?-Oe:z.key==="ArrowRight"?Oe:0,le=z.key==="ArrowUp"?-Oe:z.key==="ArrowDown"?Oe:0;i.nudgeNodes(Ae(),he,le)&&z.preventDefault();return}if(!(z.metaKey||z.ctrlKey))return;const Ce=z.key.toLowerCase();Ce==="c"?(x(),z.preventDefault()):Ce==="v"?(R(i.paste()),z.preventDefault()):Ce==="z"&&(z.shiftKey?i.redo():i.undo(),z.preventDefault())}n.onMounted(async()=>{xe(),await n.nextTick(),ae(),window.addEventListener("keydown",Q),window.addEventListener("pointerup",me),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Q),window.removeEventListener("pointerup",me),window.removeEventListener("pointermove",f)});function me(){p.value=null}function ve(){u.value=!0,g.value=null}function Ee(){var Ce;u.value=!1;const z=(Ce=document.elementFromPoint(m.x,m.y))==null?void 0:Ce.closest(".vue-flow__node"),q=z==null?void 0:z.dataset.id;if(!q){g.value=null;return}const ue=z.classList.contains("vue-flow__node-group")?"group":z.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:ue,id:q}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],xe),n.watch(()=>i.revision.value,Te),n.watch(()=>i.resolved.value,z=>{const q=g.value;if(!q)return;(q.kind==="entity"?z.entities.some(Ce=>Ce.entity.modelId===q.id):q.kind==="group"?z.groups.some(Ce=>Ce.group.modelId===q.id):z.notes.some(Ce=>Ce.note.modelId===q.id))||(g.value=null)});function $e(z){const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};return{x:q.x+ue.width/2,y:q.y+ue.height/2}}function Me(z){const q=z.node;if(q){if(g.value=null,q.type==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===q.id);y.value=ue?{groupId:q.id,dx:q.position.x-ue.geo.location.x,dy:q.position.y-ue.geo.location.y}:null,p.value=null;return}if(q.type!=="entity"&&q.type!=="note"){p.value=null;return}p.value=be($e(q))}}function Ue(z){var Ce;p.value=null,y.value=null;const q=(Ce=z.nodes)!=null&&Ce.length?z.nodes:[z.node],ue=q.filter(Be=>(Be==null?void 0:Be.type)==="group");if(ue.length){for(const Be of ue){if(!Be)continue;const Oe=i.resolved.value.entities.filter(he=>he.groupRef===Be.id).map(he=>{const le=G(he.entity.modelId),Pe=(le==null?void 0:le.computedPosition)??(le==null?void 0:le.position)??{x:0,y:0};return{id:he.entity.modelId,location:{x:Pe.x,y:Pe.y}}});i.dragGroup(Be.id,{x:Be.position.x,y:Be.position.y},Oe)}return}for(const Be of q){if(!Be||Be.type==="group")continue;const Oe=Be.computedPosition??Be.position,he=Be.dimensions??{width:0,height:0},le={x:Oe.x+he.width/2,y:Oe.y+he.height/2};Be.type==="note"?i.dropNote(Be.id,{x:Oe.x,y:Oe.y},be(le)):i.dropEntity(Be.id,{x:Oe.x,y:Oe.y},be(le))}}function Ye(z){var Pe,Ke,st,Ze,pt;if(!i.editable.value||!z.source||!z.target)return;const q=((Pe=G(z.source))==null?void 0:Pe.type)==="note",ue=((Ke=G(z.target))==null?void 0:Ke.type)==="note";if(q||ue){if(q&&ue)return;const nt=q?z.source:z.target,at=q?z.target:z.source;((st=G(at))==null?void 0:st.type)==="entity"&&i.addNoteConnection(nt,at);return}const Ce=nt=>{var at;return(at=i.state.logical.entities.find(ct=>ct.modelId===nt))==null?void 0:at.stereotype},Be=Ce(z.source)==="JPA_EMBEDDABLE",Oe=Ce(z.target)==="JPA_EMBEDDABLE";if(Be||Oe){if(Be&&Oe)return;const nt=Be?z.source:z.target,at=Be?z.target:z.source;i.addEmbedAssociation(at,nt);return}const he=(Ze=z.sourceHandle)!=null&&Ze.startsWith("r:")?z.sourceHandle.slice(2):void 0,le=(pt=z.targetHandle)!=null&&pt.startsWith("l:")?z.targetHandle.slice(2):void 0;i.addAssociation(z.source,z.target,he,le)}const Fe=n.ref(null);function gt(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.attributeStyles)==null?void 0:Ce[q])}function w(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.operationStyles)==null?void 0:Ce[q])}function M(z){var q;return ut((q=i.state.layout.groupLayouts.find(ue=>ue.groupRef===z))==null?void 0:q.style)}function I(z){var q;return ut((q=i.state.layout.notes.find(ue=>ue.modelId===z))==null?void 0:q.style)}function D(z){var Be,Oe;if(z.preventDefault(),!i.editable.value)return;const q=()=>S({x:z.clientX,y:z.clientY}),ue=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const he=q();i.addEntity("NewEntity",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const he=q();i.addNote("메모",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const he=q();i.addEmptyGroup({x:he.x,y:he.y})}}],Ce=(Be=i.clipboard.value)==null?void 0:Be.kind;(Ce==="entity"||Ce==="entities")&&ue.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>R(i.paste())}),i.resolved.value.entities.length>0&&ue.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Oe=Fe.value)==null||Oe.open(z,ue)}function B({event:z,node:q}){var Pe,Ke,st,Ze,pt,nt,at,ct,pf,hf,yf,gf,bf,_f,kf,Ef,Nf,wf;const ue=z;if(ue.preventDefault(),!i.editable.value){if(q.type==="group"||q.type==="note")return;const je=(Ke=(Pe=ue.target)==null?void 0:Pe.closest("[data-attr]"))==null?void 0:Ke.dataset.attr;if(je){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===q.id&&Qe.ids.includes(je)||i.selectAttribute(q.id,je);const Jt=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[je];(Ze=Fe.value)==null||Ze.open(ue,[{caption:Jt.length>1?i.t("em.ctx.copyN",{n:Jt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=Fe.value)==null||pt.open(ue,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)},V(q.id)]);return}if(q.type==="group"){const je=i.isGroupLocked(q.id),Qe=[];je||Qe.push({type:"swatches",caption:i.t("em.common.color"),current:M(q.id),onPick:Jt=>i.setGroupSwatch(q.id,Jt)},{type:"separator"});const rt=L()&&ke().includes(q.id)?j():we(q.id);rt.length&&Qe.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(rt)}),Qe.push({caption:je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:je?"unlock":"lock",handler:()=>i.setGroupLocked(q.id,!je)}),je||Qe.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(q.id)}),(nt=Fe.value)==null||nt.open(ue,Qe);return}if(q.type==="note"){(at=Fe.value)==null||at.open(ue,[{type:"swatches",caption:i.t("em.common.color"),current:I(q.id),onPick:je=>i.setNoteSwatch(q.id,je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(q.id)}]);return}const Ce=(pf=(ct=ue.target)==null?void 0:ct.closest("[data-attr]"))==null?void 0:pf.dataset.attr;if(Ce){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===q.id&&je.ids.includes(Ce)||i.selectAttribute(q.id,Ce);const rt=((hf=i.selection.value)==null?void 0:hf.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[Ce];if(i.isEntityLocked(q.id)){(yf=Fe.value)==null||yf.open(ue,[{caption:rt.length>1?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Jt=rt.length>1,Tl=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{type:"swatches",caption:Jt?i.t("em.ctx.colorN",{n:rt.length}):i.t("em.common.color"),current:Jt?null:gt(q.id,Ce),onPick:xT=>i.setAttributeSwatches(q.id,rt,xT)},{type:"separator"},{caption:Jt?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],li=i.clipboard.value;(li==null?void 0:li.kind)==="attribute"&&Tl.push({caption:li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),Tl.push({type:"separator"},{caption:Jt?i.t("em.ctx.deleteAttrN",{n:rt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(q.id,rt)}),(gf=Fe.value)==null||gf.open(ue,Tl);return}const Be=(_f=(bf=ue.target)==null?void 0:bf.closest("[data-op]"))==null?void 0:_f.dataset.op;if(Be){if(i.isEntityLocked(q.id))return;(kf=Fe.value)==null||kf.open(ue,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(q.id)},{type:"swatches",caption:i.t("em.common.color"),current:w(q.id,Be),onPick:je=>i.setOperationSwatch(q.id,Be,je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(q.id,Be)}]);return}const Oe=i.resolved.value.entities.find(je=>je.entity.modelId===q.id),he=!!(Oe!=null&&Oe.locked),le=[{caption:he?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)}];if(!he){le.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(q.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const Qe=W.value.filter(rt=>rt.type==="entity").map(rt=>rt.id);i.createGroup(Qe.includes(q.id)&&Qe.length?Qe:[q.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(q.id,q.id)});const je=i.embeddableCatalog.value;if(je.length){le.push({type:"separator"});for(const Qe of je){const rt=((Ef=Qe.label)==null?void 0:Ef.ko)??((Nf=Qe.label)==null?void 0:Nf.en)??Qe.type;le.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:rt}),icon:"link",handler:()=>i.addPredefinedEmbed(q.id,Qe.type)})}}}if(le.push({type:"separator"}),le.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(q.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!he&&le.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(q.id)}),le.push({caption:he?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:he?"unlock":"lock",handler:()=>i.setEntityLocked(q.id,!he)}),le.push(V(q.id)),!he){const je=i.clipboard.value;(je==null?void 0:je.kind)==="attribute"&&le.push({caption:je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),le.push({type:"separator"}),le.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(q.id)})}(wf=Fe.value)==null||wf.open(ue,le)}function de({event:z,edge:q}){var Be,Oe;const ue=z;if(ue.preventDefault(),!i.editable.value)return;const Ce=h(q.id);if(Ce){(Be=Fe.value)==null||Be.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Ce.noteRef,Ce.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Ce.noteRef,Ce.targetRef)}]);return}(Oe=Fe.value)==null||Oe.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(q.id)},{type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(q.id)}])}function J(z){return z==="group"?"group":z==="note"?"note":"entity"}function X({node:z}){if(W.value.length>1){i.selection.value=null;return}i.selection.value={kind:J(z.type),id:z.id}}function te({nodes:z}){z.length>1&&(i.selection.value=null)}function re({edge:z}){const q=h(z.id);i.selection.value=q?{kind:"note",id:q.noteRef}:{kind:"association",id:z.id}}function Ne(z){const q=i.selection.value;return!!q&&q.kind!=="attribute"&&q.id===z.id}function $(z){var q,ue;return Ne(z)?z.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":z.type==="note"?"var(--em-note-soft)":z.type==="group"?Mu(ut((q=z.data)==null?void 0:q.style),!0)??"var(--em-mm-group)":Mu(ut((ue=z.data)==null?void 0:ue.style))??"var(--em-mm-entity)"}function Z(z){return Ne(z)?"var(--em-selection)":z.type==="note"?"var(--em-note-accent)":z.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function F(z,q){E(z,q,{zoom:Y().zoom,duration:350})}n.watch(()=>i.focusRequest.value,z=>{if(!z)return;const q=G(z.id);if(!q)return;const ue=q.computedPosition??q.position,Ce=q.dimensions??{width:0,height:0};F(ue.x+Ce.width/2,ue.y+Ce.height/2)});function Ie({position:z}){F(z.x,z.y)}function ye({node:z}){i.selection.value={kind:J(z.type),id:z.id};const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};F(q.x+ue.width/2,q.y+ue.height/2)}function ze({node:z}){ae({nodes:[z.id],duration:350,maxZoom:1.2,padding:.6})}return(z,q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":d.value,"is-panning":u.value}])},[n.createVNode(n.unref(ck),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ie.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(Kt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ve,onMoveEnd:Ee,onConnect:Ye,onConnectStart:q[1]||(q[1]=ue=>d.value=!0),onConnectEnd:q[2]||(q[2]=ue=>d.value=!1),onNodeDrag:Me,onNodeDragStop:Ue,onNodeClick:X,onEdgeClick:re,onSelectionChange:te,onPaneClick:q[3]||(q[3]=ue=>n.unref(i).selection.value=null),onPaneContextMenu:D,onNodeContextMenu:B,onEdgeContextMenu:de},{"node-group":n.withCtx(ue=>[n.createVNode(qu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-entity":n.withCtx(ue=>[n.createVNode(Wu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-note":n.withCtx(ue=>[n.createVNode(Xu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-association":n.withCtx(ue=>[n.createVNode(dm,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-note-connection":n.withCtx(ue=>[n.createVNode(sS,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Xw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Nv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(Tn),{class:"em-palette__group-start",title:n.unref(i).t("em.ctx.addEntity"),onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.ctx.addNote"),onClick:pe},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.palette.autoLayout"),onClick:q[0]||(q[0]=ue=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(iS),{key:1,pannable:"",width:224,height:160,"node-color":$,"node-stroke-color":Z,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Ie,onNodeClick:ye,onNodeDblclick:ze})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ce.value?(n.openBlock(),n.createElementBlock("div",WS,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("p",qS,n.toDisplayString(n.unref(i).t("em.canvas.emptyTitle")),1),n.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:n.unref(i).t("em.canvas.emptyHint")},null,8,XS),n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:n.unref(i).t("em.canvas.emptyShortcutHint")},null,8,JS)],64)):(n.openBlock(),n.createElementBlock("p",ZS,n.toDisplayString(n.unref(i).t("em.canvas.emptyReadonly")),1))])):n.createCommentVNode("",!0),r.value?(n.openBlock(),n.createBlock(KS,{key:1,controller:n.unref(i),onClose:q[4]||(q[4]=ue=>r.value=!1)},null,8,["controller"])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[c.value?(n.openBlock(),n.createElementBlock("div",QS,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",e$,[n.createElementVNode("strong",t$,n.toDisplayString(c.value.title),1),n.createElementVNode("span",n$,n.toDisplayString(c.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(_S,{ref_key:"menuRef",ref:Fe,locale:n.unref(i).uiLocale.value},null,8,["locale"]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",o$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-a49d9d63"]]),i$={class:"em-explorer em-scroll-overlay"},a$={class:"em-explorer__search"},r$=["placeholder","aria-label"],l$=["aria-label","title"],s$={key:0,class:"em-explorer__empty"},c$={class:"em-explorer__rows"},d$=["data-key","onClick","onDblclick"],u$=["onClick"],m$=["title"],f$={class:"em-key-slot"},p$={class:"em-key-slot"},h$={class:"em-explorer__label"},df=Ge(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.computed(()=>{var O;const A=i.resolved.value,G=i.displayMode.value,K=i.userLanguage.value,v=U=>{var ne,ce,ge;return ci(G,U.name,(ce=(ne=U.table)==null?void 0:ne.logicalName)==null?void 0:ce[K],(ge=U.table)==null?void 0:ge.physicalName,i.t("em.node.logicalMissing"))},T=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",H=U=>{const ne=U.attrType.startsWith("RELATION")&&U.dbAttrs.length>0;return{icon:U.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:U.identifier,fk:ne&&T}}},C=U=>U.attrType.startsWith("EMBED")&&U.dbAttrs.length>0,ae=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",E=U=>{if(U.attrType!=="EMBED_PREDEF")return U.dbAttrs;const ne=i.embeddableCatalog.value.find(ce=>ce.type===U.type);return ne?U.dbAttrs.map((ce,ge)=>{const se=ne.fields[ge];return se?{...ce,physicalName:ce.physicalName||se.physicalName,logicalName:ce.logicalName??se.logicalName,dataType:ce.dataType||se.dataType,length:ce.length??se.length}:ce}):U.dbAttrs},Y=(U,ne)=>{var pe,be,xe,Te,Ae,fe,ke,we,j;const ce={entityId:ne,attrId:U.modelId};if(C(U)){const L=Za(G,U);return{key:`attr:${U.modelId}`,label:U.name+(L?` : ${L}`:""),icon:"table",attrRef:ce,focusId:ne,matchText:po(U.name,(be=(pe=U.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:be[K],(xe=U.dbAttrs[0])==null?void 0:xe.physicalName),children:ae?E(U).map(x=>{var R,V;return{key:`attr:${U.modelId}:col:${x.modelId}`,label:ci(G,x.physicalName,(R=x.logicalName)==null?void 0:R[K],x.physicalName,i.t("em.node.logicalMissing"))+(x.dataType?` : ${x.dataType}`:""),icon:"field",attrRef:ce,focusId:ne,matchText:po(x.physicalName,(V=x.logicalName)==null?void 0:V[K]),children:[]}}):[]}}const ge=Ja(U,i.state.logical.associations),se=Za(G,U,ge);return{key:`attr:${U.modelId}`,label:ci(G,U.name,(Ae=(Te=U.dbAttrs[0])==null?void 0:Te.logicalName)==null?void 0:Ae[K],(fe=U.dbAttrs[0])==null?void 0:fe.physicalName,i.t("em.node.logicalMissing"))+(se?` : ${se}`:""),...H(U),attrRef:ce,focusId:ne,matchText:po(U.name,(we=(ke=U.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:we[K],(j=U.dbAttrs[0])==null?void 0:j.physicalName),children:[]}},S=U=>{var ge,se,pe;const ne=U.entity,ce=[...ne.attributes].sort((be,xe)=>be.order-xe.order);return{key:`entity:${ne.modelId}`,label:v(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:po(ne.name,(se=(ge=ne.table)==null?void 0:ge.logicalName)==null?void 0:se[K],(pe=ne.table)==null?void 0:pe.physicalName),children:ce.map(be=>Y(be,ne.modelId))}},W=new Map,ee=[];for(const U of A.entities)if(U.groupRef){const ne=W.get(U.groupRef)??[];ne.push(U),W.set(U.groupRef,ne)}else ee.push(U);const ie=[];for(const U of A.groups){const ne=U.group;ie.push({key:`group:${ne.modelId}`,label:((O=ne.name)==null?void 0:O.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(W.get(ne.modelId)??[]).map(S)})}for(const U of ee)ie.push(S(U));if(A.associations.length){const U=new Map(A.entities.map(ne=>[ne.entity.modelId,v(ne.entity)]));ie.push({key:"section:associations",label:i.t("em.explorer.associations",{n:A.associations.length}),icon:"arrow-lr",children:A.associations.map(ne=>{const ce=ne.association,ge=U.get(ce.end1.entityRef)??ce.end1.entityRef,se=U.get(ce.end2.entityRef)??ce.end2.entityRef;return{key:`assoc:${ce.modelId}`,label:`${ge} — ${se}`,icon:"arrow-lr",selectKind:"association",selectId:ce.modelId,children:[]}})})}return A.notes.length&&ie.push({key:"section:notes",label:i.t("em.explorer.notes",{n:A.notes.length}),icon:"note",children:A.notes.map(({note:U})=>{var ne;return{key:`note:${U.modelId}`,label:((ne=U.memo.split(`
62
+ `)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:U.modelId,focusId:U.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ie}});function l(A){return A?A.pk&&A.fk?i.t("em.node.keyPfk"):A.pk?i.t("em.node.keyPk"):A.fk?i.t("em.node.keyFk"):"":""}const s=n.ref(new Set);function c(A){const G=new Set(s.value);G.has(A)?G.delete(A):G.add(A),s.value=G}const d=n.ref(""),u=n.ref(null),m=n.computed(()=>d.value.trim().length>0),f=n.computed(()=>{const A=[];if(m.value){const K=VS(r.value,d.value.trim().toLowerCase()),v=(T,H)=>{if(K.has(T.key)){A.push({node:T,depth:H});for(const C of T.children)v(C,H+1)}};return v(r.value,0),A}const G=(K,v)=>{if(A.push({node:K,depth:v}),!s.value.has(K.key))for(const T of K.children)G(T,v+1)};return G(r.value,0),A}),p=n.computed(()=>m.value&&f.value.length<=1);function y(A){var v;if(A.key!=="/"||A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;const G=A.target,K=G==null?void 0:G.tagName;K==="INPUT"||K==="TEXTAREA"||K==="SELECT"||G!=null&&G.isContentEditable||(A.preventDefault(),(v=u.value)==null||v.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const g=n.computed(()=>{const A=[],G=K=>{if(K.children.length){K.key!=="root"&&A.push(K.key);for(const v of K.children)G(v)}};return G(r.value),A}),_=n.computed(()=>!g.value.some(A=>s.value.has(A)));function b(){s.value=_.value?new Set(g.value):new Set}t({toggleAll:b,allExpanded:_,hasExpandable:n.computed(()=>g.value.length>0)});function N(A){const G=i.selection.value;return A.attrRef?(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.attrRef.entityId&&G.ids.includes(A.attrRef.attrId):!!G&&G.kind!=="attribute"&&!!A.selectId&&A.selectKind===G.kind&&A.selectId===G.id}function h(A){const G=i.selection.value;return A.selectKind==="entity"&&(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.selectId}function k(A,G){if(A.attrRef){const K=G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace";i.selectAttribute(A.attrRef.entityId,A.attrRef.attrId,K)}else A.selectKind&&A.selectId&&(i.selection.value={kind:A.selectKind,id:A.selectId});A.focusId&&i.requestFocus(A.focusId)}function P(A){A.selectKind==="entity"&&A.selectId&&pa(a,i,A.selectId)}return(A,G)=>(n.openBlock(),n.createElementBlock("section",i$,[n.createElementVNode("div",a$,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":G[0]||(G[0]=K=>d.value=K),class:"em-explorer__search-input",type:"text",placeholder:n.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":n.unref(i).t("em.explorer.searchAria"),onKeydown:G[1]||(G[1]=n.withKeys(K=>d.value="",["esc"]))},null,40,r$),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":n.unref(i).t("em.explorer.clearSearchAria"),title:n.unref(i).t("em.explorer.clearSearchTitle"),onClick:G[2]||(G[2]=K=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})],8,l$)):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",s$,n.toDisplayString(n.unref(i).t("em.explorer.noMatches")),1)):n.createCommentVNode("",!0),n.createElementVNode("div",c$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value,({node:K,depth:v})=>(n.openBlock(),n.createElementBlock("div",{key:K.key,class:n.normalizeClass(["em-explorer__row",{"is-active":N(K),"is-focus-parent":h(K),"is-selectable":!!K.selectKind||!!K.attrRef||!!K.focusId}]),"data-key":K.key,style:n.normalizeStyle({paddingLeft:4+v*14+"px"}),onClick:T=>k(K,T),onDblclick:T=>P(K)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!K.children.length,"is-open":!s.value.has(K.key)}]),onClick:n.withModifiers(T=>K.children.length&&c(K.key),["stop"])},[K.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,u$),K.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(K.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",f$,[K.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):K.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",p$,[K.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,m$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:15},null,8,["name"])),n.createElementVNode("span",h$,n.toDisplayString(K.label),1)],46,d$))),128))])]))}}),[["__scopeId","data-v-7b20d13b"]]),y$={class:"em-text-export"},g$={key:0,class:"em-text-export__tabs",role:"tablist"},b$=["aria-selected","onClick"],_$={class:"em-text-export__pre"},k$={class:"em-text-export__actions"},E$=Ge(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(c,d)=>Ct(t.locale??"ko",c,d),a=n.ref(0);function r(){return t.formats[a.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(r().content),oe.showNotification(i("em.export.copied"),"info")}catch{oe.showNotification(i("em.export.copyFailed"),"error")}}function s(){const c=r(),d=new Blob([c.content],{type:"text/plain;charset=utf-8"}),u=URL.createObjectURL(d);try{const m=document.createElement("a");m.href=u,m.download=c.filename,document.body.appendChild(m),m.click(),m.remove()}finally{URL.revokeObjectURL(u)}}return(c,d)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:t.title??i("em.export.title")},{default:n.withCtx(()=>[n.createElementVNode("div",y$,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",g$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(u,m)=>(n.openBlock(),n.createElementBlock("button",{key:u.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":m===a.value}]),"aria-selected":m===a.value,onClick:f=>a.value=m},n.toDisplayString(u.label),11,b$))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",_$,n.toDisplayString(r().content),1),n.createElementVNode("div",k$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.copy"),onClick:l},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.download"),onClick:s},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:d[0]||(d[0]=u=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-f31001c1"]]),N$={class:"em-text-import"},w$={class:"em-text-import__formats",role:"tablist"},v$=["aria-selected","onClick"],x$=["placeholder"],I$={class:"em-text-import__status"},C$={class:"em-text-import__ok"},S$={key:0,class:"em-text-import__warn"},$$={key:1,class:"em-text-import__err"},R$={key:2,class:"em-text-import__err"},A$={key:3,class:"em-text-import__err"},T$={class:"em-text-import__actions"},V$=Ge(n.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(f,p)=>Ct(t.locale??"ko",f,p),a=n.ref(""),r=n.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}];function s(f){return f?f.startsWith("{")?"json":/\berdiagram\b/i.test(f)?"mermaid":/\bcreate\s+table\b/i.test(f)?"ddl":null:null}const c=n.computed(()=>r.value==="auto"?s(a.value.trim()):r.value),d=n.computed(()=>{const f=a.value.trim();if(!f)return{status:"empty"};const p=c.value;if(!p)return{status:"unknown"};try{let y,g=[];return p==="json"?y=as(f):p==="mermaid"?y=Kl(f):(y=Xl(f),g=Wa(f).warnings),y.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:y,warnings:g}}catch(y){return{status:"error",message:y instanceof Error?y.message:String(y)}}}),u=n.computed(()=>d.value.status==="ok");function m(){const f=d.value;f.status!=="ok"||!f.source||(t.onImport(f.source),o.close())}return(f,p)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.import.title")},{default:n.withCtx(()=>[n.createElementVNode("div",N$,[n.createElementVNode("div",w$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,y=>n.createElementVNode("button",{key:y.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-import__fmt",{"is-active":y.key===r.value}]),"aria-selected":y.key===r.value,onClick:g=>r.value=y.key},n.toDisplayString(i(y.labelKey)),11,v$)),64))]),n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,x$),[[n.vModelText,a.value]]),n.createElementVNode("div",I$,[d.value.status==="ok"&&d.value.source?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",C$,n.toDisplayString(i("em.import.detected",{format:i(`em.import.format${c.value==="json"?"Json":c.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+n.toDisplayString(i("em.import.summary",{entities:d.value.source.logical.entities.length,relations:d.value.source.logical.associations.length})),1),d.value.warnings&&d.value.warnings.length?(n.openBlock(),n.createElementBlock("span",S$," ⚠ "+n.toDisplayString(i("em.import.warnings",{n:d.value.warnings.length})),1)):n.createCommentVNode("",!0)],64)):d.value.status==="error"?(n.openBlock(),n.createElementBlock("span",$$,n.toDisplayString(i("em.import.error",{message:d.value.message??""})),1)):d.value.status==="unknown"?(n.openBlock(),n.createElementBlock("span",R$,n.toDisplayString(i("em.import.unknownFormat")),1)):d.value.status==="emptyParse"?(n.openBlock(),n.createElementBlock("span",A$,n.toDisplayString(i("em.import.emptyParse")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("div",T$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.import.confirm"),disabled:!u.value,onClick:m},null,8,["caption","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[1]||(p[1]=y=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-43a94e55"]]),M$={class:"em-toolbar"},B$={class:"em-toolbar__mode"},uf=Ge(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,r=oe.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=n.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=i.state.logical;r.openModal({component:E$,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Ul(y),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ka(y,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ka(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:ns(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:is(y,i.state.layout),filename:"diagram.json"}]}})}function f(){r.openModal({component:V$,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function p(){r.openModal({component:sf,bind:{locale:i.uiLocale.value}})}return(y,g)=>(n.openBlock(),n.createElementBlock("div",M$,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.undo"),disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:g[0]||(g[0]=_=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.redo"),disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:g[1]||(g[1]=_=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",B$,[n.createTextVNode(n.toDisplayString(n.unref(i).t("em.toolbar.displayLabel"))+" ",1),n.createVNode(n.unref(oe.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>n.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(n.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:n.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:n.unref(i).t("em.toolbar.grid"),tooltip:n.unref(i).t(n.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:n.unref(i).t("em.toolbar.minimap"),tooltip:n.unref(i).t(n.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.import"),disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportText"),onClick:m},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[g[8]||(g[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:n.unref(i).t("em.toolbar.history"),tooltip:n.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","caption","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:n.unref(i).t("em.toolbar.shortcuts"),onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-38de55b4"]]),D$=["title"],O$=["title"],L$=["disabled","aria-pressed"],P$=["disabled","aria-pressed"],z$=Ge(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=l=>Ct(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[n.createVNode(Ve,{name:"lock",size:14}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.frozen")),1)],8,D$)):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[n.createVNode(Ve,{name:"eye",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.view")),1)],10,L$),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.edit")),1)],10,P$)],10,O$))}}),[["__scopeId","data-v-2b5162b7"]]),U$=["disabled"],F$={class:"em-panel__sub"},H$={class:"em-nav"},G$={key:0,class:"em-nav__divider","aria-hidden":"true"},j$={key:1},K$=["onClick","onKeydown"],Y$={class:"em-nav__name"},W$=["title"],q$={key:0,class:"em-panel__note"},X$=["data-attr-block"],J$={class:"em-attr__row"},Z$=["title"],Q$={key:0,class:"em-attr__row"},eR={class:"em-attr__row"},tR={class:"em-attr__row"},nR={class:"em-attr__flags"},oR={class:"em-attr__pii"},iR={class:"em-attr__pii"},aR={class:"em-attr__pii"},rR={key:0,class:"em-attr__pii em-attr__codetop"},lR={class:"em-multilang"},sR={key:2,class:"em-embed-cols"},cR={class:"em-embed-col__label"},dR={class:"em-attr__row"},uR={class:"em-attr__row"},mR={key:0,class:"em-embed-upd"},fR={class:"em-embed-upd"},pR={class:"em-embed-upd"},hR={class:"em-swatch__row em-attr__swatch"},yR=["title","onClick"],gR=["title","onClick"],bR={key:0,class:"em-attr__swatch-hint"},Oa="__OWN__",_R=Ge(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),r=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(Z=>Z.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>l.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function m($){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,$.modelId)}function f($){const Z=u($),F=[Z.pk&&"PK",Z.fk&&"FK",Z.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function p($,Z){i.value&&o.selectAttribute(i.value.modelId,$.modelId,Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace")}const y=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function g($){return $==="none"?o.t("em.common.noneParen"):$}const _=$=>$;function b($){var Z,F;return ut((F=(Z=a.value)==null?void 0:Z.attributeStyles)==null?void 0:F[$.modelId])}function N($){return l.value.size>1&&l.value.has($.modelId)}function h($,Z){if(!i.value)return;const F=N($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,F,Z)}function k($,Z){i.value&&o.updateAttribute(i.value.modelId,$.modelId,Z)}function P($,Z){k($,{naturalId:Z||void 0,naturalIdMutable:Z?$.naturalIdMutable:void 0})}function A(){return{naturalId:void 0,naturalIdMutable:void 0}}function G($,Z){k($,{identifier:Z,...Z?A():{}})}function K($,Z){k($,{transient:Z||void 0,...Z?A():{}})}function v($){return!!$.transient}const T=$=>$.value,H=$=>$.label;function C($,Z){if(!Z)return;const F=O.value.find(Ie=>Ie.type===Z);if(F){const Ie=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};k($,{type:Z,customType:void 0,dbAttrs:[{...Ie,dataType:F.dataType,length:F.length,scale:F.scale}]});return}k($,Z===Rt?{type:Z}:{type:Z,customType:void 0})}function ae($,Z){k($,{customType:Z.trim()===""?void 0:Z})}function E($,Z){const Ie={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...Z};Z.dataType!==void 0&&!_o.has(Ie.dataType)&&(Ie.scale=void 0),k($,{dbAttrs:[Ie]})}function Y($){var Z;return _o.has(((Z=$.dbAttrs[0])==null?void 0:Z.dataType)??"")}function S($,Z){E($,{logicalName:Object.keys(Z).length?Z:void 0})}function W($,Z){k($,{description:Object.keys(Z).length?Z:void 0})}function ee($){return $.personalInfoAttributeType??"none"}function ie($,Z){k($,{personalInfoAttributeType:Z==="none"?void 0:Z})}const O=n.computed(()=>o.predefinedCustomTypeCatalog.value),U=n.computed(()=>o.embeddableCatalog.value),ne=n.ref(void 0);function ce($){var Z,F;return((Z=$.label)==null?void 0:Z.ko)??((F=$.label)==null?void 0:F.en)??$.type}function ge($){if(!$||!i.value)return;const Z=o.addPredefinedEmbed(i.value.modelId,$);Z&&o.selectAttribute(i.value.modelId,Z),ne.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const pe=n.computed(()=>o.groupCodeCatalog.value);function be($){var Z;return((Z=pe.value.find(F=>F.groupCode===$.groupCode))==null?void 0:Z.codes)??[]}function xe($){return["none",...be($)]}function Te($){return $==="none"?"none":$.code}function Ae($){var F,Ie;if($==="none")return o.t("em.common.noneParen");const Z=((F=$.label)==null?void 0:F.ko)??((Ie=$.label)==null?void 0:Ie.en);return Z?`${$.code} (${Z})`:$.code}function fe($,Z){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,Z)}function ke($,Z){k($,{defaultValue:Z==="none"?void 0:Z})}function we($,Z){k($,{defaultValue:Z.trim()===""?void 0:Z})}function j($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function L($,Z,F){const Ie=$.dbAttrs.map((ye,ze)=>{if(ze!==Z)return ye;const z={...ye,...F};for(const q of Object.keys(F))F[q]===void 0&&delete z[q];return z});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,Ie)}function x($,Z,F){L($,Z,{logicalName:Object.keys(F).length?F:void 0})}function R($,Z){var ye,ze,z;if($.attrType==="EMBED_PREDEF"){const q=(ye=o.embeddableCatalog.value.find(ue=>ue.type===$.type))==null?void 0:ye.fields[Z];return q?{name:q.name,physicalName:q.physicalName,dataType:q.dataType,length:q.length,shareable:q.shareable,logicalName:q.logicalName}:void 0}const F=(ze=$.embedded)==null?void 0:ze.embeddableRef;if(!F)return;const Ie=(z=o.state.logical.entities.find(q=>q.modelId===F))==null?void 0:z.attributes.flatMap(q=>q.dbAttrs)[Z];return Ie?{physicalName:Ie.physicalName,dataType:Ie.dataType,length:Ie.length,scale:Ie.scale,logicalName:Ie.logicalName}:void 0}function V($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.dataType)||((Ie=$.dbAttrs[Z])==null?void 0:Ie.dataType)||""}function Q($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.length)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.length)}function me($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.scale)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.scale)}const ve=["inherit","true","false"];function Ee($){return $==="inherit"?o.t("em.common.inherit"):$}function $e($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Me($,Z,F){L($,Z,{updatable:F==="inherit"?void 0:F==="true"})}function Ue($,Z){E($,{updatable:Z==="inherit"?void 0:Z==="true"})}const Ye=["inherit","true","false"];function Fe($){return $==="inherit"?o.t("em.common.inherit"):$}function gt($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function w($,Z,F){L($,Z,{insertable:F==="inherit"?void 0:F==="true"})}function M($,Z){E($,{insertable:Z==="inherit"?void 0:Z==="true"})}const I=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),D=n.computed(()=>mn(I.value.flatMap($=>$.attributes.flatMap(Z=>Z.dbAttrs)))),B=n.computed(()=>I.value.flatMap($=>$.attributes.filter(Z=>Z.attrType==="NORMAL"&&Z.dbAttrs.length===1&&Z.dbAttrs[0]).map(Z=>{var F;return{modelId:Z.dbAttrs[0].modelId,physical:Z.dbAttrs[0].physicalName||Z.name,isCurrency:Z.type==="Currency",ownerName:$.modelId===((F=i.value)==null?void 0:F.modelId)?void 0:$.name}})));function de(){const $=[...B.value].sort((Z,F)=>Number(F.isCurrency)-Number(Z.isCurrency));return[Oa,...$.map(Z=>Z.modelId)]}function J($){if($===Oa)return o.t("em.attr.sharedOwn");const Z=B.value.find(Ie=>Ie.modelId===$);if(!Z)return $;const F=Z.ownerName?`${Z.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:F,physical:Z.physical,mode:Z.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function X($){return($==null?void 0:$.sharedColumnRef)??Oa}function te($,Z,F){L($,Z,{sharedColumnRef:F===Oa?void 0:F})}function re($){return($==null?void 0:$.sharedColumnRef)!=null}function Ne($){var Z;return((Z=zn($,D.value))==null?void 0:Z.physicalName)??""}return($,Z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",F$,[n.createTextVNode(n.toDisplayString(n.unref(o).t("em.attr.section",{n:s.value.length}))+" ",1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:se},null,8,["caption"]),U.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"120px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":ne.value,items:U.value,"value-provider":F=>F.type,"label-provider":ce,"onUpdate:modelValue":ge},null,8,["placeholder","model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",H$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,F=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:F.modelId},[F.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",G$,[...Z[0]||(Z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",j$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":l.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:Ie=>p(F,Ie),onKeydown:[n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["enter"]),n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["space"])]},[n.createElementVNode("span",Y$,n.toDisplayString(F.name||n.unref(o).t("em.attr.nameless")),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(F)},[u(F).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,W$)],42,K$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",q$,n.toDisplayString(n.unref(o).t("em.attr.selectHint")),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var Ie,ye,ze,z,q,ue,Ce,Be,Oe,he;return n.openBlock(),n.createElementBlock("div",{key:F.modelId,class:n.normalizeClass(["em-attr",{"is-focused":l.value.has(F.modelId)}]),"data-attr-block":F.modelId},[n.createElementVNode("div",J$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":F.name,"onUpdate:modelValue":le=>k(F,{name:le})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Ql)(F.type,O.value),"value-provider":T,"label-provider":H,"model-value":F.type,"onUpdate:modelValue":le=>C(F,le)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:m(F)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:le=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])],8,Z$)]),F.type===n.unref(Rt)?(n.openBlock(),n.createElementBlock("div",Q$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":F.customType??"","onUpdate:modelValue":le=>ae(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),j(F)?(n.openBlock(),n.createElementBlock("div",sR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(le,Pe)=>{var Ke,st,Ze,pt,nt,at;return n.openBlock(),n.createElementBlock("div",{key:le.modelId,class:"em-embed-col"},[n.createElementVNode("span",cR,n.toDisplayString(((Ke=R(F,Pe))==null?void 0:Ke.name)??((st=R(F,Pe))==null?void 0:st.physicalName)??n.unref(o).t("em.attr.colFallback",{n:Pe+1})),1),n.createElementVNode("div",dR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`embed-col-${le.modelId}`,width:"100%",disabled:re(le),placeholder:((Ze=R(F,Pe))==null?void 0:Ze.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":re(le)?Ne(le):le.physicalName,"onUpdate:modelValue":ct=>L(F,Pe,{physicalName:ct})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSTextInput),{name:`embed-dtype-${le.modelId}`,width:"84px",disabled:"","model-value":V(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-len-${le.modelId}`,width:"48px",disabled:"","model-value":Q(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-scale-${le.modelId}`,width:"48px",disabled:"","model-value":me(F,Pe)},null,8,["name","model-value"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":le.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",uR,[n.createVNode(Rn,{class:"grow",name:`embed-logical-${le.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((nt=(pt=R(F,Pe))==null?void 0:pt.logicalName)==null?void 0:nt.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":le.logicalName,"onUpdate:modelValue":ct=>x(F,Pe,ct)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(at=R(F,Pe))!=null&&at.shareable?(n.openBlock(),n.createElementBlock("label",mR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"110px","model-value":X(le),items:de(),"value-provider":_,"label-provider":J,"onUpdate:modelValue":ct=>ct&&te(F,Pe,ct)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",fR,[Z[3]||(Z[3]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":gt(le),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":ct=>ct&&w(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",pR,[Z[4]||(Z[4]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":$e(le),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":ct=>ct&&Me(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",eR,[n.createVNode(Rn,{class:"grow",name:`attr-logical-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Ie=F.dbAttrs[0])==null?void 0:Ie.logicalName,"onUpdate:modelValue":le=>S(F,le)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",tR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:v(F),"model-value":((ye=F.dbAttrs[0])==null?void 0:ye.physicalName)??"","onUpdate:modelValue":le=>E(F,{physicalName:le})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:v(F),items:n.unref(Jl)(((ze=F.dbAttrs[0])==null?void 0:ze.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":_,"label-provider":n.unref(qa),"model-value":((z=F.dbAttrs[0])==null?void 0:z.dataType)??"","onUpdate:modelValue":le=>le&&E(F,{dataType:le})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:v(F),"model-value":(q=F.dbAttrs[0])==null?void 0:q.length,"onUpdate:modelValue":le=>E(F,{length:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:v(F)||!Y(F),"model-value":(ue=F.dbAttrs[0])==null?void 0:ue.scale,"onUpdate:modelValue":le=>E(F,{scale:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":(Ce=F.dbAttrs[0])==null?void 0:Ce.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",nR,[n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:r.value||v(F),"onUpdate:modelValue":le=>G(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:v(F),"onUpdate:modelValue":le=>k(F,{notNull:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((Be=F.dbAttrs[0])!=null&&Be.unique),disabled:v(F),"onUpdate:modelValue":le=>E(F,{unique:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Oe=F.dbAttrs[0])!=null&&Oe.autoIncrement),disabled:v(F)||!F.identifier,"onUpdate:modelValue":le=>E(F,{autoIncrement:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-tr-${F.modelId}`,label:"@Transient","model-value":!!F.transient,disabled:F.identifier,"onUpdate:modelValue":le=>K(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||v(F),"onUpdate:modelValue":le=>P(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:v(F)||!F.naturalId,"onUpdate:modelValue":le=>k(F,{naturalIdMutable:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((he=F.dbAttrs[0])!=null&&he.multiValue),disabled:v(F),"onUpdate:modelValue":le=>E(F,{multiValue:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",oR,[Z[1]||(Z[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":gt(F.dbAttrs[0]),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":le=>le&&M(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",iR,[Z[2]||(Z[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":$e(F.dbAttrs[0]),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":le=>le&&Ue(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",aR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":ee(F),items:y,"value-provider":_,"label-provider":g,"onUpdate:modelValue":le=>le&&ie(F,le)},null,8,["model-value","onUpdate:modelValue"])]),pe.value.length?(n.openBlock(),n.createElementBlock("label",rR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":F.groupCode,items:pe.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":le=>fe(F,le)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!pe.value.length}])},[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),be(F).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:xe(F),"value-provider":Te,"label-provider":Ae,"onUpdate:modelValue":le=>le&&ke(F,le)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":F.defaultValue??"","onUpdate:modelValue":le=>we(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",lR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`attr-desc-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":F.description,"onUpdate:modelValue":le=>W(F,le)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",hR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(F)===null}]),title:n.unref(o).t("em.swatch.none"),onClick:le=>h(F,null)},"∅",10,yR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),le=>(n.openBlock(),n.createElementBlock("button",{key:le,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(F)===le}]),style:n.normalizeStyle({background:n.unref(ao)(le)}),title:n.unref(io)(le),onClick:Pe=>h(F,le)},null,14,gR))),128)),N(F)?(n.openBlock(),n.createElementBlock("span",bR,n.toDisplayString(n.unref(o).t("em.attr.batchHint",{n:l.value.size})),1)):n.createCommentVNode("",!0)])],10,X$)}),128))],8,U$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-7fd67ee7"]]),kR=["disabled"],ER={class:"em-panel__sub-label"},NR={class:"em-attr__row"},wR={class:"em-field em-idx-params"},vR=["value","placeholder","onChange"],xR=Ge(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),l=n.computed(()=>r.value?go(r.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var g;return[...(((g=r.value)==null?void 0:g.attributes)??[]).map(_=>({value:_.modelId,label:_.name})),...l.value.map(_=>({value:_.modelId,label:a.t("em.index.inherited",{field:_.field})}))]});function c(){var _;if(!r.value)return;const g=r.value.attributes[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((_=r.value.indexes)==null?void 0:_.length)??0)+1}`,unique:!1,columns:g?[{columnRef:g.modelId,descending:!1}]:[]})}function d(g,_){r.value&&a.updateIndex(r.value.modelId,g,_)}function u(g){var b;const _=(b=r.value)==null?void 0:b.attributes[0];_&&d(g.modelId,{columns:[...g.columns,{columnRef:_.modelId,descending:!1}]})}function m(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,columnRef:b}:N)})}function f(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,descending:b}:N)})}function p(g,_){d(g.modelId,{columns:g.columns.filter((b,N)=>N!==_)})}function y(g,_){d(g.modelId,{parameters:_.trim()===""?void 0:_})}return(g,_)=>{var b;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:_[0]||(_[0]=N=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",ER,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.index.section",{n:((b=r.value.indexes)==null?void 0:b.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:n.withModifiers(c,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.indexes??[],N=>(n.openBlock(),n.createElementBlock("div",{key:N.modelId,class:"em-attr"},[n.createElementVNode("div",NR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`idx-name-${N.modelId}`,width:"100%",placeholder:n.unref(a).t("em.index.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":h=>d(N.modelId,{name:h})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-uq-${N.modelId}`,class:"em-check",label:"UQ","model-value":N.unique,"onUpdate:modelValue":h=>d(N.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(r.value.modelId,N.modelId)},null,8,["onClick"])]),n.createVNode($n,{controller:n.unref(a),"ref-id":N.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.columns,(h,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(oe.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":P=>P.value,"label-provider":P=>P.label,"onUpdate:modelValue":P=>P&&m(N,k,P)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-${N.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":P=>f(N,k,P)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:"−",onClick:P=>p(N,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.index.addColumn"),onClick:h=>u(N)},null,8,["caption","onClick"]),n.createElementVNode("label",wR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.parameters??"",rows:"2",placeholder:n.unref(a).t("em.index.conditionPlaceholder"),onChange:h=>y(N,h.target.value)},null,40,vR)])]))),128)):n.createCommentVNode("",!0)],8,kR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d883aded"]]),IR=["disabled"],CR={class:"em-panel__sub-label"},SR={class:"em-attr__row"},$R={class:"em-attr__row"},RR={class:"em-multilang"},AR={class:"em-attr__pii"},TR={class:"em-swatch__row em-attr__swatch"},VR=["title","onClick"],MR=["title","onClick"],BR=Ge(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=oe.useModal(),l=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function f(h,k){l.value&&a.updateOperation(l.value.modelId,h.modelId,k)}function p(h,k){f(h,{description:Object.keys(k).length?k:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function g(h,k){f(h,{personalInfoAttributeType:k==="none"?void 0:k})}function _(h){var k,P;return ut((P=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:P[h.modelId])}function b(h,k){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,k)}function N(h){r.openModal({component:Fu,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:k=>f(h,{sourceCode:k})}})}return(h,k)=>{var P;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=A=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",CR,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.op.section",{n:((P=l.value.operations)==null?void 0:P.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:k[0]||(k[0]=n.withModifiers(A=>n.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.operations??[],A=>(n.openBlock(),n.createElementBlock("div",{key:A.modelId,class:"em-attr"},[n.createElementVNode("div",SR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:n.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":G=>f(A,{name:G})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":G=>G&&f(A,{visibility:G})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:G=>n.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),n.createElementVNode("div",$R,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:G=>N(A)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",RR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`op-desc-${A.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":G=>p(A,G)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",AR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":G=>G&&g(A,G)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",TR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:n.unref(a).t("em.swatch.none"),onClick:G=>b(A,null)},"∅",10,VR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(A)===G}]),style:n.normalizeStyle({background:n.unref(ao)(G)}),title:n.unref(io)(G),onClick:K=>b(A,G)},null,14,MR))),128))])]))),128)):n.createCommentVNode("",!0)],8,IR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-394829bc"]]),DR=["title"],OR={class:"em-panel__head"},LR={class:"em-panel__head-row"},PR=["title"],zR={class:"em-panel__context"},UR={key:0,class:"em-panel__lock"},FR=["disabled"],HR={key:0,class:"em-panel__note"},GR={key:1,class:"em-panel__note"},jR={key:2,class:"em-jpa"},KR={class:"em-field"},YR={class:"em-field"},WR={class:"em-field"},qR={key:0,class:"em-field"},XR={class:"em-panel__note"},JR={class:"em-panel__sub"},ZR={class:"em-field"},QR={class:"em-jpa"},eA={key:0,class:"em-panel__note"},tA={class:"em-jpa"},nA={class:"em-field"},oA={key:0,class:"em-panel__note"},iA={class:"em-field"},aA={class:"em-multilang"},rA={class:"em-field"},lA=["value"],sA={class:"em-field"},cA={class:"em-swatch"},dA={class:"em-swatch__row"},uA=["title"],mA=["title","onClick"],fA={class:"em-panel__note"},pA={class:"em-field"},hA=["value"],yA={class:"em-swatch"},gA={class:"em-swatch__row"},bA=["title"],_A=["title","onClick"],mf=Ge(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.selection.value),l=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const x=l.value;return x?a.state.logical.entities.find(R=>R.modelId===x)??null:null}),c=n.computed(()=>{const x=r.value;if((x==null?void 0:x.kind)==="association"){const V=a.state.logical.associations.find(Q=>Q.modelId===x.id);return!!V&&(a.isEntityLocked(V.end1.entityRef)||a.isEntityLocked(V.end2.entityRef))}const R=l.value;return!!R&&a.isEntityLocked(R)}),d=n.computed(()=>{var x;return((x=a.selectedAttr.value)==null?void 0:x.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),m=n.computed(()=>d.value!==null),f=n.ref({});n.watch(m,()=>{f.value={}});function p(x){return f.value[x]??m.value}function y(x){f.value={...f.value,[x]:!p(x)}}const g=n.computed(()=>{var V;const x=s.value;if(!x)return a.t("em.entity.fallback");const R=(V=x.table)==null?void 0:V.physicalName;return R?`${x.name} (${R})`:x.name}),_=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="association"?a.state.logical.associations.find(R=>R.modelId===x.id)??null:null}),b=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="group"?a.state.logical.groups.find(R=>R.modelId===x.id)??null:null}),N=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="note"?a.state.layout.notes.find(R=>R.modelId===x.id)??null:null}),h=n.computed(()=>{var R,V;const x=(R=b.value)==null?void 0:R.name;return(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||((V=b.value)==null?void 0:V.packageName)||a.t("em.group.fallback")}),k=n.computed(()=>{if(s.value){const x=u.value.size;if(x>1)return a.t("em.inspector.ctxEntityAttrs",{name:s.value.name,n:x});if(d.value){const R=s.value.attributes.find(V=>V.modelId===d.value);return(R==null?void 0:R.attrType)==="DIVIDER"?a.t("em.inspector.ctxEntityDivider",{name:s.value.name}):a.t("em.inspector.ctxEntityAttr",{name:s.value.name,attr:(R==null?void 0:R.name)??""})}return a.t("em.inspector.ctxEntity",{name:s.value.name})}if(_.value){const x=R=>{var V;return((V=a.state.logical.entities.find(Q=>Q.modelId===R))==null?void 0:V.name)??R};return a.t("em.inspector.ctxAssoc",{a:x(_.value.end1.entityRef),b:x(_.value.end2.entityRef)})}return b.value?a.t("em.inspector.ctxGroup",{name:h.value}):N.value?a.t("em.inspector.ctxNote"):a.t("em.inspector.ctxNone")}),P=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],A=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],G={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},K=x=>{const R=G[x];return R?a.t(R):x},v=x=>{var R;return((R=a.state.logical.entities.find(V=>V.modelId===x))==null?void 0:R.name)??x},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],H=["LIST","SET"],C=["inherit","LAZY","EAGER"],ae=x=>x;function E(x){return x==="inherit"?a.t("em.common.inherit"):x}const Y=n.computed(()=>!!_.value&&_.value.end1.entityRef===_.value.end2.entityRef);function S(x,R){_.value&&a.updateAssociationEnd(_.value.modelId,x,R)}function W(x){_.value&&!Y.value&&a.setAssociationIdentifying(_.value.modelId,x)}function ee(x){var R,V,Q;return!!((Q=(V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.cascadeTypes)!=null&&Q.includes("ALL"))}function ie(x,R,V){var ve,Ee;const Q=(ve=_.value)==null?void 0:ve[x];if(R==="ALL"&&V){S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:["ALL"]}});return}const me=new Set(((Ee=Q==null?void 0:Q.jpa)==null?void 0:Ee.cascadeTypes)??[]);V?me.add(R):me.delete(R),S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:[...me]}})}function O(x,R){var Q;const V=(Q=_.value)==null?void 0:Q[x];S(x,{jpa:{...V==null?void 0:V.jpa,...R}})}function U(x){var R,V;return((V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.fetchType)??"inherit"}function ne(x,R){O(x,{fetchType:R==="inherit"?void 0:R})}function ce(x){var V;const R=(V=_.value)==null?void 0:V[x==="end1"?"end2":"end1"];return(R==null?void 0:R.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(R==null?void 0:R.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ge=n.computed(()=>{const x=_.value;if(!x)return null;for(const R of a.state.logical.entities){const V=R.attributes.find(Ee=>{var $e;return(($e=Ee.embedded)==null?void 0:$e.associationRef)===x.modelId&&Ee.attrType==="EMBED_OWN"});if(!V)continue;const Q=x.end2.entityRef===V.embedded.embeddableRef?"end2":"end1",me=x[Q].multiplicity,ve=x[Q].jpa;return{which:Q,cardinality:me,isCollection:me==="ZERO_OR_MORE_INSTANCES"||me==="ONE_OR_MORE_INSTANCES",collectionType:(ve==null?void 0:ve.collectionType)??"LIST",collectionTable:(ve==null?void 0:ve.collectionTable)??"",orderColumn:(ve==null?void 0:ve.orderColumn)??""}}return null});function se(x){_.value&&a.setEmbedCardinality(_.value.modelId,x)}function pe(x){const R=ge.value;R&&O(R.which,x==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function be(x){const R=ge.value;R&&O(R.which,{collectionTable:x.trim()||void 0})}function xe(x){const R=ge.value;R&&O(R.which,{orderColumn:x.trim()||void 0})}function Te(x){b.value&&a.updateGroup(b.value.modelId,x)}function Ae(x,R){var V;Te({name:{...(V=b.value)==null?void 0:V.name,[x]:R}})}const fe=n.computed(()=>{var x;return b.value?ut((x=a.state.layout.groupLayouts.find(R=>R.groupRef===b.value.modelId))==null?void 0:x.style):null});function ke(x){b.value&&a.setGroupSwatch(b.value.modelId,x)}function we(x){N.value&&a.setNoteMemo(N.value.modelId,x)}const j=n.computed(()=>{var x;return ut((x=N.value)==null?void 0:x.style)});function L(x){N.value&&a.setNoteSwatch(N.value.modelId,x)}return(x,R)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:n.unref(a).t("em.panel.resizeWidth"),onPointerdown:R[0]||(R[0]=(...V)=>e.startResize&&e.startResize(...V))},null,42,DR),n.createElementVNode("header",OR,[n.createElementVNode("div",LR,[R[14]||(R[14]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:n.unref(a).t("em.panel.collapse"),onClick:R[1]||(R[1]=V=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})],8,PR)]),n.createElementVNode("p",zR,n.toDisplayString(k.value),1),c.value&&l.value?(n.openBlock(),n.createElementBlock("div",UR,[n.createVNode(Ve,{name:"lock",size:13}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.panel.lockedBanner")),1),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:R[2]||(R[2]=V=>n.unref(a).setEntityLocked(l.value,!1))},n.toDisplayString(n.unref(a).t("em.panel.unlock")),1)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Du,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:g.value,onToggle:R[3]||(R[3]=V=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(_R,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(xR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:R[4]||(R[4]=V=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(BR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:R[5]||(R[5]=V=>y("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(oe.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:n.unref(a).t("em.assoc.identifying"),"model-value":!!_.value.identifying,disabled:Y.value||!!ge.value,"onUpdate:modelValue":W},null,8,["label","model-value","disabled"]),Y.value?(n.openBlock(),n.createElementBlock("p",HR,n.toDisplayString(n.unref(a).t("em.assoc.selfNoIdentifying")),1)):ge.value?(n.openBlock(),n.createElementBlock("p",GR,n.toDisplayString(n.unref(a).t("em.assoc.embedNoIdentifying")),1)):n.createCommentVNode("",!0),ge.value?(n.openBlock(),n.createElementBlock("fieldset",jR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.embed.legend")),1),n.createElementVNode("label",KR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.embed.cardinality")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.cardinality,items:A,"value-provider":ae,"label-provider":K,"onUpdate:modelValue":R[6]||(R[6]=V=>V&&se(V))},null,8,["model-value"])]),ge.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",YR,[R[15]||(R[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.collectionType,items:H,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":R[7]||(R[7]=V=>V&&pe(V))},null,8,["model-value"])]),n.createElementVNode("label",WR,[R[16]||(R[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:n.unref(a).t("em.embed.collectionTablePlaceholder"),"model-value":ge.value.collectionTable,"onUpdate:modelValue":be},null,8,["placeholder","model-value"])]),ge.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",qR,[R[17]||(R[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:n.unref(a).t("em.embed.orderColumnPlaceholder"),"model-value":ge.value.orderColumn,"onUpdate:modelValue":xe},null,8,["placeholder","model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),n.createElementVNode("p",XR,n.toDisplayString(n.unref(a).t("em.embed.ownerFixedNote")),1)])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],V=>{var Q,me,ve;return n.withDirectives(n.createElementVNode("div",{key:V,class:"em-end"},[n.createElementVNode("h4",JR,n.toDisplayString(V)+" → "+n.toDisplayString(v(_.value[V].entityRef)),1),ge.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",ZR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.assoc.multiplicity")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":_.value[V].multiplicity,items:P,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":Ee=>S(V,{multiplicity:Ee})},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-navigable`,class:"em-check",label:"navigable","model-value":_.value[V].navigable,"onUpdate:modelValue":Ee=>S(V,{navigable:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-composition`,class:"em-check",label:"composition","model-value":_.value[V].composition,"onUpdate:modelValue":Ee=>S(V,{composition:Ee})},null,8,["name","model-value","onUpdate:modelValue"])],64)),n.createElementVNode("fieldset",QR,[R[18]||(R[18]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(T,Ee=>{var $e,Me;return n.createVNode(n.unref(oe.BSCheckbox),{key:Ee,name:`${V}-cascade-${Ee}`,class:"em-check",label:Ee,"model-value":!!((Me=($e=_.value[V].jpa)==null?void 0:$e.cascadeTypes)!=null&&Me.includes(Ee)),disabled:Ee!=="ALL"&&ee(V),"onUpdate:modelValue":Ue=>ie(V,Ee,Ue)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ee(V)?(n.openBlock(),n.createElementBlock("p",eA,n.toDisplayString(n.unref(a).t("em.assoc.cascadeAllNote")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",tA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.assoc.jpaDetails")),1),n.createElementVNode("label",nA,[R[19]||(R[19]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":U(V),items:C,"value-provider":ae,"label-provider":E,"onUpdate:modelValue":Ee=>Ee&&ne(V,Ee)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Q=_.value[V].jpa)!=null&&Q.orphanRemoval),disabled:ce(V),"onUpdate:modelValue":Ee=>O(V,{orphanRemoval:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ce(V)&&((me=_.value[V].jpa)!=null&&me.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",oA,n.toDisplayString(n.unref(a).t("em.assoc.orphanRemovalNote")),1)):n.createCommentVNode("",!0),n.createElementVNode("label",iA,[R[20]||(R[20]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:`${V}-orderby`,width:"100%",placeholder:n.unref(a).t("em.assoc.orderByPlaceholder"),"model-value":((ve=_.value[V].jpa)==null?void 0:ve.orderBy)??"","onUpdate:modelValue":Ee=>O(V,{orderBy:Ee.trim()||void 0})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])])]),[[n.vShow,!ge.value||V===ge.value.which]])}),64))],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",aA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.group.nameLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,V=>{var Q;return n.openBlock(),n.createElementBlock("label",{key:V,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(V),1),n.createVNode(n.unref(oe.BSTextInput),{name:`grp-name-${V}`,width:"100%","model-value":((Q=b.value.name)==null?void 0:Q[V])??"","onUpdate:modelValue":me=>Ae(V,me)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",rA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:R[8]||(R[8]=V=>Te({description:V.target.value}))},null,40,lA)]),n.createElementVNode("label",sA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":R[9]||(R[9]=V=>Te({packageName:V}))},null,8,["model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:n.unref(a).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":R[10]||(R[10]=V=>Te({excludeDDLGeneration:V}))},null,8,["label","model-value"]),n.createElementVNode("fieldset",cA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",dA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":fe.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[11]||(R[11]=V=>ke(null))},"∅",10,uA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":fe.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>ke(V)},null,14,mA))),128))])]),n.createElementVNode("p",fA,n.toDisplayString(n.unref(a).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",pA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.memo")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:R[12]||(R[12]=V=>we(V.target.value))},null,40,hA)]),n.createElementVNode("fieldset",yA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",gA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":j.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[13]||(R[13]=V=>L(null))},"∅",10,bA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":j.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>L(V)},null,14,_A))),128))])])],64)):n.createCommentVNode("",!0)],8,FR)],4))}}),[["__scopeId","data-v-4a891fbf"]]),kA=["title"],EA={class:"em-validation__title"},NA=["title","onClick"],wA={key:0,class:"em-validation__body"},vA={class:"em-validation__opt"},xA={key:0,class:"em-validation__empty"},IA={key:1,class:"em-validation__empty"},CA={key:2,class:"em-validation__list"},SA=["onClick"],$A={class:"em-validation__item-msg"},RA={key:0,class:"em-validation__item-entity"},AA=["title","onClick"],TA=["title"],VA=Ge(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=wk(g);if(!_)return null;const b=a.value.get(_);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:Bu(o.t,g),category:Ek(o.t,g.ruleId)}))),m=n.ref(!1);function f(g){c.value[g]=!c.value[g]}function p(g){if(!m.value){m.value=!0;return}f(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=b=>m.value=!m.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:n.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),n.createElementVNode("span",EA,n.toDisplayString(n.unref(o).t("em.validation.title")),1)],8,kA),n.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:m.value?n.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:n.unref(o).t(l[b].labelKey)}):n.unref(o).t("em.validation.expandPanel"),onClick:N=>p(b)},[n.createVNode(Ve,{name:l[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,NA)),64))])]),m.value?(n.openBlock(),n.createElementBlock("div",wA,[n.createElementVNode("label",vA,[n.createVNode(n.unref(oe.BSCheckbox),{name:"val-flag-norel",label:n.unref(o).t("em.validation.checkOrphanEntities"),"model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",xA,n.toDisplayString(n.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(n.openBlock(),n.createElementBlock("p",IA,n.toDisplayString(n.unref(o).t("em.validation.noVisibleIssues")),1)):(n.openBlock(),n.createElementBlock("ul",CA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:N,message:h,category:k},P)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${P}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:A=>y(b)},[n.createVNode(Ve,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",$A,[N?(n.openBlock(),n.createElementBlock("span",RA,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(h),1)]),n.unref(o).hasQuickFix(b)?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:n.unref(o).t("em.validation.quickFixTip"),onClick:n.withModifiers(A=>n.unref(o).applyQuickFix(b),["stop"])},n.toDisplayString(n.unref(o).t("em.validation.quickFix")),9,AA)):n.createCommentVNode("",!0),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(k),9,TA)],10,SA))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),MA={class:"em-history"},BA={class:"em-history__head"},DA={class:"em-history__title"},OA={class:"em-history__head-actions"},LA=["title","disabled"],PA=["title"],zA={class:"em-history__filters"},UA={class:"em-history__filter"},FA={class:"em-history__body"},HA={key:0,class:"em-history__empty"},GA={key:1,class:"em-history__empty is-error"},jA={key:2,class:"em-history__empty"},KA={key:3,class:"em-history__list"},YA=["onClick"],WA={class:"em-history__summary"},qA={class:"em-history__seq"},XA={class:"em-history__gmeta"},JA={class:"em-history__who"},ZA={key:0,class:"em-history__time"},QA={key:1,class:"em-history__restored-from"},eT={key:0,class:"em-history__detail"},tT={class:"em-history__action-head"},nT={class:"em-history__action-name"},oT={key:0,class:"em-history__fields"},iT={class:"em-history__fname"},aT={key:0,class:"em-history__old"},rT={class:"em-history__val"},lT={key:1,class:"em-history__restore"},sT={class:"em-history__confirm-msg"},cT=["disabled","onClick"],dT=["disabled"],uT=["onClick"],mT=Ge(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref([]),l=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){l.value=!0,s.value=null;try{r.value=await a.historyTransport(),c.value=!0}catch(O){s.value=O instanceof Error?O.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,O=>{O&&u()},{immediate:!0});let m=null;n.watch(()=>a.revision.value,()=>{o.open&&(m&&clearTimeout(m),m=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const f=n.computed(()=>new Map(a.state.logical.entities.map(O=>[O.modelId,O]))),p=n.computed(()=>new Map(a.state.logical.associations.map(O=>[O.modelId,O]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(O=>{var U;return[O.modelId,O.packageName||((U=O.name)==null?void 0:U.ko)||O.modelId]})));function g(O){var ge,se,pe,be,xe,Te,Ae;const U=p.value.get(O);if(!U)return a.t("em.history.assocFallback");if((ge=U.description)!=null&&ge.trim())return U.description.trim();const ne=(be=(pe=f.value.get((se=U.end1)==null?void 0:se.entityRef))==null?void 0:pe.name)==null?void 0:be.trim(),ce=(Ae=(Te=f.value.get((xe=U.end2)==null?void 0:xe.entityRef))==null?void 0:Te.name)==null?void 0:Ae.trim();return ne&&ce?`${ne}→${ce}`:a.t("em.history.assocFallback")}function _(O){var U,ne,ce,ge;if(O.kind==="entity")return((ne=(U=f.value.get(O.ref))==null?void 0:U.name)==null?void 0:ne.trim())||a.t("em.attr.nameless");if(O.kind==="attribute"||O.kind==="operation"||O.kind==="index"){const se=O.entityRef?f.value.get(O.entityRef):void 0,be=((O.kind==="attribute"?se==null?void 0:se.attributes:O.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Te=>Te.modelId===O.ref),xe=(ce=se==null?void 0:se.name)==null?void 0:ce.trim();return`${xe?xe+".":""}${((ge=be==null?void 0:be.name)==null?void 0:ge.trim())||O.ref}`}return O.kind==="association"?g(O.ref):O.kind==="associationEnd"?`${g(O.ref)}(${O.end})`:O.kind==="group"?a.t("em.history.groupSubject",{name:y.value.get(O.ref)??O.ref}):O.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},h=n.ref("all"),k=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],P=n.computed({get:()=>h.value,set:O=>{O&&(h.value=O)}}),A=n.computed(()=>vs(r.value)),G=n.computed(()=>A.value.length?A.value[0].seq:null),K=n.computed(()=>h.value==="all"?A.value:A.value.filter(O=>(O.kind??"edit")===h.value));function v(O){return O===void 0?"—":O===null?a.t("em.history.emptyValue"):typeof O=="object"?JSON.stringify(O):String(O)}function T(O){const U=_(O.subject);if(O.verb==="add")return a.t("em.history.summaryAdd",{name:U});if(O.verb==="remove")return a.t("em.history.summaryRemove",{name:U});if(O.fields.length===1){const ne=O.fields[0];return`${U}.${ne.field} ${ne.oldValue!==void 0?v(ne.oldValue)+"→":""}${v(ne.value)}`}return a.t("em.history.summaryFields",{name:U,n:O.fields.length})}function H(O){return O.actions.length===0?a.t("em.history.noChange"):O.actions.length===1?T(O.actions[0]):a.t("em.history.summaryMore",{summary:T(O.actions[0]),n:O.actions.length-1})}const C=n.ref(new Set);function ae(O){const U=new Set(C.value);U.has(O)?U.delete(O):U.add(O),C.value=U}function E(O){if(O==null)return"";const U=new Date(O);return isNaN(U.getTime())?String(O):U.toLocaleString()}function Y(O){const U=O.author,ne=O.origin;return U&&ne?`${U}(${ne})`:U||(ne?`(${ne})`:"—")}const S=n.ref(null),W=n.ref(!1);function ee(O){S.value=O}async function ie(O){W.value=!0;try{const U=await a.restoreToSeq(O);U.ok||(s.value=a.t("em.history.restoreFailed",{reason:U.reason??a.t("em.history.unknown")}))}finally{W.value=!1,S.value=null}}return(O,U)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",MA,[n.createElementVNode("header",BA,[n.createElementVNode("div",DA,[n.createVNode(Ve,{name:"undo",size:15}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.history.title")),1)]),n.createElementVNode("div",OA,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.history.refresh"),disabled:l.value,onClick:U[0]||(U[0]=ne=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,LA),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.common.close"),onClick:U[1]||(U[1]=ne=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})],8,PA)])]),n.createElementVNode("div",zA,[n.createElementVNode("label",UA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.toolbar.displayLabel")),1),n.createVNode(n.unref(oe.BSSelect),{modelValue:P.value,"onUpdate:modelValue":U[2]||(U[2]=ne=>P.value=ne),items:k,"value-provider":ne=>ne.v,"label-provider":ne=>n.unref(a).t(ne.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",FA,[l.value&&!c.value?(n.openBlock(),n.createElementBlock("p",HA,n.toDisplayString(n.unref(a).t("em.history.loading")),1)):s.value?(n.openBlock(),n.createElementBlock("p",GA,n.toDisplayString(s.value),1)):K.value.length===0?(n.openBlock(),n.createElementBlock("p",jA,n.toDisplayString(c.value?n.unref(a).t("em.history.emptyLoaded"):n.unref(a).t("em.history.emptyNotLoaded")),1)):(n.openBlock(),n.createElementBlock("ul",KA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(K.value,ne=>(n.openBlock(),n.createElementBlock("li",{key:ne.seq,class:n.normalizeClass(["em-history__group",[`is-${ne.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ce=>ae(ne.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":C.value.has(ne.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${ne.kind??"edit"}`])},n.toDisplayString(n.unref(a).t(ne.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),n.createElementVNode("span",WA,n.toDisplayString(H(ne)),1),n.createElementVNode("span",qA,"#"+n.toDisplayString(ne.seq),1)],8,YA),n.createElementVNode("div",XA,[n.createElementVNode("span",JA,n.toDisplayString(Y(ne)),1),ne.ts?(n.openBlock(),n.createElementBlock("span",ZA,n.toDisplayString(E(ne.ts)),1)):n.createCommentVNode("",!0),ne.kind==="restore"&&ne.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",QA,"← #"+n.toDisplayString(ne.restoredFromSeq),1)):n.createCommentVNode("",!0)]),C.value.has(ne.seq)?(n.openBlock(),n.createElementBlock("div",eT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.actions,(ce,ge)=>(n.openBlock(),n.createElementBlock("div",{key:ge,class:"em-history__action"},[n.createElementVNode("div",tT,[n.createVNode(Ve,{name:b[ce.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",nT,n.toDisplayString(_(ce.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ce.verb}`])},n.toDisplayString(n.unref(a).t(N[ce.verb])),3)]),ce.fields.length?(n.openBlock(),n.createElementBlock("ul",oT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.fields,(se,pe)=>(n.openBlock(),n.createElementBlock("li",{key:pe,class:"em-history__field"},[n.createElementVNode("span",iT,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",aT,n.toDisplayString(v(se.oldValue)),1)):n.createCommentVNode("",!0),se.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",rT,n.toDisplayString(v(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&ne.seq!==G.value?(n.openBlock(),n.createElementBlock("div",lT,[S.value===ne.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",sT,n.toDisplayString(n.unref(a).t("em.history.confirmRestore")),1),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:ce=>ie(ne.seq)},n.toDisplayString(n.unref(a).t("em.history.doRestore")),9,cT),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:U[3]||(U[3]=ce=>S.value=null)},n.toDisplayString(n.unref(a).t("em.history.cancel")),9,dT)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ce=>ee(ne.seq)},[n.createVNode(Ve,{name:"undo",size:12}),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.history.restoreToHere")),1)],8,uT))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-45d29598"]]);function fT(e,t){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=t?i:null}function ff(e){const t=n.ref(fT(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),t.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const pT={class:"em-modeler"},hT={class:"em-modeler__body"},yT={class:"em-drawer__inner"},gT={class:"em-drawer__head"},bT={class:"em-drawer__actions"},_T=["title"],kT=["title"],ET=["title"],NT=["title"],wT=["title"],vT=Ge(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:r,startResize:l}=ff({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=ff({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),m=n.ref(null);return(f,p)=>{var y,g,_;return n.openBlock(),n.createElementBlock("div",pT,[n.createVNode(uf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=b=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onExportPng:p[1]||(p[1]=b=>{var N;return(N=u.value)==null?void 0:N.exportPng()}),onToggleHistory:p[2]||(p[2]=b=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",hT,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",yT,[n.createElementVNode("header",gT,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",bT,[(y=m.value)!=null&&y.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((g=m.value)!=null&&g.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:p[3]||(p[3]=b=>{var N;return(N=m.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(_=m.value)!=null&&_.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,_T)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:p[4]||(p[4]=b=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})],8,kT)])]),n.createVNode(df,{ref_key:"explorer",ref:m,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(r)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:p[5]||(p[5]=(...b)=>n.unref(l)&&n.unref(l)(...b))},null,42,ET),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:p[6]||(p[6]=b=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],8,NT),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(r),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(cf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(mf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:p[7]||(p[7]=b=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:p[8]||(p[8]=b=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],8,wT),[[n.vShow,!o.value]])]),_:1}),n.createVNode(mT,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=b=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(VA,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-cce29135"]]);_e.APPLY_MODEL_OPS_INPUT_SCHEMA=Bh,_e.AssociationEdge=dm,_e.CUSTOM_TYPE_VALUE=Rt,_e.CommandStack=mr,_e.DEFAULT_JAVA_TYPE=Xa,_e.DIAGRAM_JSON_FORMAT=tr,_e.DIAGRAM_JSON_VERSION=nr,_e.DiagramCanvas=cf,_e.DiagramExplorer=df,_e.EDITOR=An,_e.EditModeToggle=z$,_e.EditorToolbar=uf,_e.EntityModeler=vT,_e.EntityNode=Wu,_e.GROUP_CODE_ENUM_VALUE=Ln,_e.GroupNode=qu,_e.INHERITED_REF_PREFIX=si,_e.InvalidDiagramJsonError=fn,_e.JAVA_TYPES=di,_e.NoteNode=Xu,_e.OpSyncAdapter=pc,_e.PHYSICAL_NAME_MAX_LENGTH=ko,_e.PropertyPanel=mf,_e.RevCache=fc,_e.SELECTABLE_JAVA_TYPES=Zl,_e.SYMBOLIC_OP_KINDS=hc,_e.SYMBOLIC_OP_SCHEMA=Ic,_e.UI_LOCALES=qk,_e.anchoredEdgePoint=Fa,_e.buildAgentBatch=Dh,_e.buildDiagramSvg=Rl,_e.buildOrthogonalPath=La,_e.buildSelfLoopPath=Bl,_e.buildStraightPath=za,_e.collectSharedColumns=un,_e.commands=nh,_e.computeAutoLayout=Dl,_e.createEditorController=ew,_e.defaultMermaidDialect=Rf,_e.defaultSqlDialect=np,_e.diagramToJson=is,_e.displayLabel=ci,_e.emptyState=Gu,_e.entityModelToDdl=ns,_e.entityModelToMermaid=Ka,_e.entityModelToText=Ul,_e.estimateEntityHeight=Ll,_e.exportDiagramPng=lf,_e.exportDiagramSvg=rf,_e.fromPersisted=Xh,_e.indexColumnsByModelId=mn,_e.isInheritedColumnRef=yo,_e.javaTypeLabel=Pn,_e.makeInheritedColumnRef=Pl,_e.mergeDiagram=_s,_e.mermaidErToImportSource=Kl,_e.migrateLegacyMoney=Dp,_e.newId=De,_e.orthogonalMidpoints=Pa,_e.packEntityBoxes=Ga,_e.parseDiagramJson=as,_e.parseInheritedColumnRef=ja,_e.parseMermaidEr=jl,_e.parseSqlDdl=Wa,_e.physicalNameLengthOverflow=mi,_e.projectActionLog=vs,_e.projectEntityAudit=Ns,_e.projectFieldAudit=Zt,_e.projectInheritedColumns=go,_e.rectExitPoint=Ua,_e.renderDiagramSvg=ls,_e.resolveColumnPhysicalName=fi,_e.resolveDiagram=Vl,_e.resolveQuickFix=ir,_e.resolveSharedColumn=zn,_e.resolveSymbolicOps=vh,_e.restoreDeepEqual=jn,_e.scaffoldEntityJava=pp,_e.segmentMidpoints=Ha,_e.sharedColumnScopeEntities=ui,_e.sideDir=ho,_e.sqlDdlToImportSource=Xl,_e.synthesizeRestoreOps=Yp,_e.toPersisted=dy,_e.toPersistedV2=uy,_e.translate=Ct,_e.uiMessagesEn=Ou,_e.uiMessagesJa=Lu,_e.uiMessagesKo=Pu,_e.validateModel=ts,Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"})}));