@visuallyjs/browser-ui 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/visuallyjs.css +22 -1
- package/js/visuallyjs.browser-ui.cjs.js +53 -53
- package/js/visuallyjs.browser-ui.esm.js +53 -53
- package/package.json +1 -1
- package/types/browser-ui/auto-pan-handler.d.ts +36 -0
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +8 -2
- package/types/browser-ui/connector-editors/editor-base.d.ts +4 -1
- package/types/browser-ui/css-constants.d.ts +16 -0
- package/types/browser-ui/edge-handler-base.d.ts +1 -1
- package/types/browser-ui/edge-input-handler.d.ts +2 -0
- package/types/browser-ui/edge-relocate-handler.d.ts +2 -2
- package/types/browser-ui/element-drag-handler-2.d.ts +12 -0
- package/types/browser-ui/plugins/browser-ui-plugin.d.ts +2 -2
- package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +1 -1
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso-plugin.d.ts +6 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso.d.ts +21 -3
- package/types/browser-ui/surface-renderer/plugins/miniview/miniview-plugin.d.ts +15 -7
- package/types/browser-ui/surface-renderer/surface.d.ts +8 -3
- package/types/core/event-constants.d.ts +29 -0
- package/types/core/geom.d.ts +32 -2
- package/types/test-support/test-support.d.ts +10 -5
- package/types/ui/core/core-events.d.ts +2 -2
- package/types/ui/core/core.d.ts +8 -0
- package/types/ui/core/definitions.d.ts +6 -0
- package/types/ui/core/event-constants.d.ts +16 -0
- package/types/version.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var pc=Object.defineProperty,bD=Object.defineProperties,CO=Object.getOwnPropertyDescriptor,AD=Object.getOwnPropertyDescriptors,SD=Object.getOwnPropertyNames,vO=Object.getOwnPropertySymbols;var PO=Object.prototype.hasOwnProperty,TD=Object.prototype.propertyIsEnumerable;var ax=(i,r,e)=>r in i?pc(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,dn=(i,r)=>{for(var e in r||(r={}))PO.call(r,e)&&ax(i,e,r[e]);if(vO)for(var e of vO(r))TD.call(r,e)&&ax(i,e,r[e]);return i},Ng=(i,r)=>bD(i,AD(r));var vD=(i,r)=>{for(var e in r)pc(i,e,{get:r[e],enumerable:!0})},CD=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of SD(r))!PO.call(i,n)&&n!==e&&pc(i,n,{get:()=>r[n],enumerable:!(t=CO(r,n))||t.enumerable});return i};var PD=i=>CD(pc({},"__esModule",{value:!0}),i),Ze=(i,r,e,t)=>{for(var n=t>1?void 0:t?CO(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&pc(r,e,n),n};var c=(i,r,e)=>(ax(i,typeof r!="symbol"?r+"":r,e),e);var k$={};vD(k$,{$__proxyEdge:()=>WS,$__unproxyEdge:()=>kS,$_createCircularSvgHandles:()=>OC,$_createRectangularSvgHandles:()=>PC,$_createSvg:()=>Ne,$_setSkeletonPosition:()=>Ey,$addOverlay:()=>Bl,$appendAtIndex:()=>qs,$attr:()=>ce,$autoCalculateChartScale:()=>Kh,$calculateChartScaleWithStep:()=>qh,$calculateChartScaleWithSteps:()=>ZP,$createConnection:()=>HS,$createGradient:()=>tT,$createMarker:()=>lc,$defaultOrthogonalPathCompute:()=>KA,$defaultStraightPathCompute:()=>J_,$doImageExport:()=>Jf,$getConnectorPathData:()=>UA,$getMarker:()=>_g,$getOverlay:()=>ME,$getOverlays:()=>mR,$isCompoundAction:()=>r_,$isGroupSizeChangedAction:()=>gb,$isMoveAction:()=>pb,$isUpdateAction:()=>ub,$makeAndAppendCircularHandle:()=>Sv,$makeAndAppendRectangularHandle:()=>Tv,$makeCircularHandle:()=>$f,$makeRectangularHandle:()=>LL,$prepareFontSpec:()=>gi,$rewriteOrthogonalConnector:()=>nS,$spaceLabels:()=>KP,$svgNode:()=>B,$updateLabelOverlayFont:()=>_E,ABSOLUTE:()=>st,ACTION_ADD:()=>_S,ACTION_REMOVE:()=>RS,ADD_CLASS_ACTION:()=>fM,ALL_GROUPS_RELAYOUT:()=>SN,ANCHOR_PLACEHOLDER_SELECTOR:()=>Gf,ANIMATION_PHASE_CANCELLED:()=>Ta,ANIMATION_PHASE_FINISHED:()=>va,ANIMATION_PHASE_INITIALIZED:()=>DC,ANIMATION_PHASE_TRAVERSING_EDGE:()=>NC,ANIMATION_PHASE_TRAVERSING_END:()=>Sy,ANIMATION_PHASE_TRAVERSING_START:()=>Ay,ANIM_SURFACE_ELEMENT_FLASH:()=>DT,APPEND_TO_CURRENT:()=>ut,AStarGrid:()=>vs,ATTRIBUTE_CHART_CATEGORY:()=>zn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>M$,ATTRIBUTE_CHART_SERIES:()=>mt,ATTRIBUTE_CHART_STACK:()=>bg,ATTRIBUTE_CHART_STACK_TOTAL:()=>Ag,ATTRIBUTE_CHART_VALUE:()=>Sg,ATTRIBUTE_CLASS:()=>sA,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>O0,ATTRIBUTE_CONTAINER:()=>rf,ATTRIBUTE_CONTEXT:()=>nA,ATTRIBUTE_CONTROLS_ORIENTATION:()=>t0,ATTRIBUTE_DATA_SHAPE_ID:()=>Wp,ATTRIBUTE_DEFAULT:()=>iA,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>lS,ATTRIBUTE_FILL:()=>RM,ATTRIBUTE_GROUP:()=>YI,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>Vu,ATTRIBUTE_GROUP_CONTENT:()=>nf,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>Mu,ATTRIBUTE_ICON_ID:()=>cL,ATTRIBUTE_ICON_KEY:()=>sv,ATTRIBUTE_ICON_SIZE:()=>ov,ATTRIBUTE_IS_GROUP:()=>Yl,ATTRIBUTE_LOOKUP:()=>Mm,ATTRIBUTE_MANAGED:()=>_t,ATTRIBUTE_NOT_DRAGGABLE:()=>wl,ATTRIBUTE_ORIENTATION:()=>hL,ATTRIBUTE_ORIGIN:()=>ep,ATTRIBUTE_ORIGIN_X:()=>nv,ATTRIBUTE_ORIGIN_Y:()=>iv,ATTRIBUTE_RESET_SELECTION:()=>jv,ATTRIBUTE_STROKE:()=>MM,ATTRIBUTE_STROKE_DASHARRAY:()=>FE,ATTRIBUTE_STROKE_DASHOFFSET:()=>NM,ATTRIBUTE_STROKE_LINECAP:()=>wM,ATTRIBUTE_STROKE_LINEJOIN:()=>LM,ATTRIBUTE_STROKE_MITERLIMIT:()=>DM,ATTRIBUTE_STROKE_OPACITY:()=>IM,ATTRIBUTE_STROKE_WIDTH:()=>VM,ATTRIBUTE_STYLE:()=>aA,ATTRIBUTE_TABINDEX:()=>xE,ATTRIBUTE_TEXT_ANCHOR:()=>GM,ATTRIBUTE_TRANSFORM:()=>ai,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>Au,ATTRIBUTE_VECTOR_EFFECT:()=>bu,ATTRIBUTE_VERSION:()=>OM,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>bE,ATTRIBUTE_VJS_EDGE:()=>qe,ATTRIBUTE_VJS_EDGE_TYPE:()=>ru,ATTRIBUTE_VJS_ENABLED:()=>gr,ATTRIBUTE_VJS_MAGNET:()=>iu,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>Nv,ATTRIBUTE_VJS_NODE_ID:()=>kf,ATTRIBUTE_VJS_OVERLAY_ID:()=>ou,ATTRIBUTE_VJS_PORT:()=>en,ATTRIBUTE_VJS_PORT_ID:()=>Dl,ATTRIBUTE_VJS_PORT_TYPE:()=>Yr,ATTRIBUTE_VJS_SCOPE:()=>Uo,ATTRIBUTE_VJS_SOURCE:()=>hS,ATTRIBUTE_VJS_SOURCE_PORT:()=>Hs,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>AE,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>Vi,ATTRIBUTE_VJS_TARGET:()=>No,ATTRIBUTE_VJS_TARGET_PORT:()=>Io,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>nu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Gi,ATTRIBUTE_VJS_VERTEX:()=>ee,ATTRIBUTE_XMLNS:()=>_M,ATT_DATA_DIR:()=>Sa,ATT_VJS_RESIZABLE:()=>gy,ATT_VJS_ROTATABLE:()=>my,ATT_VJS_X_RESIZE:()=>uy,ATT_VJS_Y_RESIZE:()=>py,AXIS_POSITION_END:()=>mi,AXIS_POSITION_START:()=>tr,AbsoluteBackedLayout:()=>Hn,AbsoluteLayout:()=>uo,AbstractEntry:()=>Di,AbstractHierarchicalLayout:()=>xs,AbstractLayout:()=>mn,AbstractLayoutAdapter:()=>Cc,AddGroupMemberAction:()=>ld,AnchorLocations:()=>vl,ArcSegmentHandler:()=>Jd,AreaChart:()=>cO,AreaPlot:()=>hc,ArrayBasedSeries:()=>Da,ArrowOverlay:()=>Or,AssignLayersStage:()=>Mc,AutoSaver:()=>hl,AvailableBackgrounds:()=>Ki,BASIC_SHAPES:()=>hv,BLOCK:()=>Cr,BOTTOM:()=>ht,BackgroundPlugin:()=>Ko,BalloonLayout:()=>Nc,BarChart:()=>uO,BarPlot:()=>Lr,Base:()=>Ac,BaseBrowserUIPlugin:()=>Te,BaseChart:()=>io,BaseDomUiLayoutAdapter:()=>na,BaseSeriesBasedChartDataSource:()=>ic,BezierEditor:()=>ui,BezierSegmentHandler:()=>V_,BlankDataSource:()=>wa,BlankScale:()=>ac,BrowserUI:()=>oa,BrowserUIClipboard:()=>op,BrowserUIModel:()=>Dy,BrowserUiRecado:()=>Ho,BubbleChart:()=>pO,BubbleChartSeries:()=>rx,CENTER:()=>Nt,CHART_AXIS_TITLE_ALIGN_END:()=>nO,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>La,CHART_AXIS_TITLE_ALIGN_START:()=>rO,CHART_TITLE_ALIGN_LEFT:()=>D$,CHART_TITLE_ALIGN_MIDDLE:()=>w$,CHART_TITLE_ALIGN_RIGHT:()=>N$,CHART_TITLE_PLACEMENT_BOTTOM:()=>nc,CHART_TITLE_PLACEMENT_TOP:()=>Xw,CLASS_ANCHOR_CANDIDATE:()=>p1,CLASS_ANCHOR_PLACEHOLDER:()=>da,CLASS_AREA_CHART:()=>WP,CLASS_AREA_CHART_AREA:()=>pg,CLASS_BACKGROUND:()=>GL,CLASS_BACKGROUND_BORDER:()=>$L,CLASS_BACKGROUND_GRID:()=>Jo,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>Ap,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>UL,CLASS_BACKGROUND_GRID_MAJOR:()=>FL,CLASS_BACKGROUND_GRID_MINOR:()=>BL,CLASS_BACKGROUND_TILE:()=>NL,CLASS_BAR_CHART:()=>VP,CLASS_BAR_CHART_BAR:()=>GP,CLASS_BEZIER_GUIDELINE:()=>sP,CLASS_BEZIER_HANDLE:()=>Uh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>wy,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>iP,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>oP,CLASS_BUBBLE_CHART:()=>$P,CLASS_BUBBLE_CHART_DATA_POINT:()=>BP,CLASS_CHART_AXIS:()=>Ra,CLASS_CHART_AXIS_LABELS:()=>$y,CLASS_CHART_AXIS_LINE:()=>By,CLASS_CHART_AXIS_TITLE:()=>Fy,CLASS_CHART_BACKGROUND:()=>OP,CLASS_CHART_BODY:()=>Wh,CLASS_CHART_CROSSHAIR:()=>Zh,CLASS_CHART_CROSSHAIR_LABEL:()=>Jh,CLASS_CHART_EMPTY:()=>Uy,CLASS_CHART_GRIDLINE:()=>Yy,CLASS_CHART_GRIDLINES:()=>zy,CLASS_CHART_LEGEND:()=>RP,CLASS_CHART_LEGEND_DOT:()=>wP,CLASS_CHART_LEGEND_ITEM:()=>hg,CLASS_CHART_LEGEND_LABEL:()=>LP,CLASS_CHART_PLOT_BACKGROUND:()=>_a,CLASS_CHART_POINT:()=>hn,CLASS_CHART_POINT_HIT_AREA:()=>ug,CLASS_CHART_SCALE_LABEL:()=>HP,CLASS_CHART_SERIES:()=>_P,CLASS_CHART_SUBTITLE:()=>YP,CLASS_CHART_TITLE:()=>zP,CLASS_CHART_X_AXIS:()=>cg,CLASS_CHART_X_AXIS_TITLE:()=>NP,CLASS_CHART_Y_AXIS:()=>dg,CLASS_CHART_Y_AXIS_TITLE:()=>DP,CLASS_COLOR_PICKER:()=>C0,CLASS_COLOR_PICKER_SWATCH:()=>eC,CLASS_COLOR_PICKER_SWATCHES:()=>Qv,CLASS_COLUMN_CHART:()=>IP,CLASS_COLUMN_CHART_COLUMN:()=>MP,CLASS_CONNECTED:()=>Nl,CLASS_CONNECTION_EDIT:()=>Vf,CLASS_CONNECTOR:()=>ks,CLASS_CONNECTOR_OUTLINE:()=>dS,CLASS_CONNECTOR_PATH:()=>cS,CLASS_CONNECTOR_SOURCE_DRAG:()=>ji,CLASS_CONNECTOR_TARGET_DRAG:()=>Hi,CLASS_CONNECTOR_TRANSIENT:()=>uS,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>XT,CLASS_CONTROLS:()=>Tp,CLASS_CONTROLS_CLEAR:()=>Fv,CLASS_CONTROLS_PAN_MODE:()=>Iv,CLASS_CONTROLS_REDO:()=>Bv,CLASS_CONTROLS_RESET_SELECTION:()=>zv,CLASS_CONTROLS_SELECT_MODE:()=>Wf,CLASS_CONTROLS_UNDO:()=>$v,CLASS_CONTROLS_ZOOM_IN:()=>Vv,CLASS_CONTROLS_ZOOM_OUT:()=>Gv,CLASS_CONTROLS_ZOOM_TO_FIT:()=>Mv,CLASS_COPY_PASTE_CONTROLS:()=>S1,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>jP,CLASS_CROSSHAIR_VALUE_AXIS:()=>XP,CLASS_DEFAULT_GROUP:()=>Sf,CLASS_DEFAULT_NODE:()=>Af,CLASS_DIAGRAM_CELL_TOOL:()=>_y,CLASS_DIAGRAM_CLONE_CELL:()=>YC,CLASS_DIAGRAM_DELETE_CELL:()=>XC,CLASS_DIAGRAM_GROUP:()=>Oy,CLASS_DIAGRAM_LINK_CELL:()=>U0,CLASS_DIAGRAM_NODE:()=>Py,CLASS_DRAG_ACTIVE:()=>mr,CLASS_DRAG_HOVER:()=>Er,CLASS_DRAG_HOVER_CANNOT_DROP:()=>oh,CLASS_DRAG_ORIGINAL_GROUP:()=>Tf,CLASS_DUMMY_VERTEX:()=>mS,CLASS_EDGE_CLICK_ENTRY:()=>Pf,CLASS_EDGE_DELETE_BUTTON:()=>Zs,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>au,CLASS_EDGE_GUIDELINE:()=>fp,CLASS_EDGE_RELOCATING:()=>xf,CLASS_EDGE_TYPE_PICKER:()=>R0,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>Vp,CLASS_EDGE_WILL_RELOCATE:()=>Yu,CLASS_ELASTIC_GROUP_RESIZE:()=>YL,CLASS_ELEMENT_DRAGGING:()=>th,CLASS_EXPORT_CANCEL:()=>Op,CLASS_EXPORT_CONTROLS:()=>Uv,CLASS_EXPORT_DIMENSIONS:()=>kv,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>Wv,CLASS_EXPORT_OVERLAY:()=>Pp,CLASS_EXPORT_UNDERLAY:()=>Cp,CLASS_GAUGE_CHART:()=>cD,CLASS_GAUGE_CHART_LABEL:()=>pD,CLASS_GAUGE_CHART_NEEDLE:()=>gD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>mD,CLASS_GAUGE_CHART_TICK:()=>uD,CLASS_GAUGE_CHART_TRACK:()=>dD,CLASS_GAUGE_CHART_ZONE:()=>gO,CLASS_GROUP:()=>Mo,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>yf,CLASS_GROUP_COLLAPSED:()=>SE,CLASS_GROUP_EXPANDED:()=>TE,CLASS_HOVER:()=>sh,CLASS_INSPECTOR:()=>v0,CLASS_INSPECTOR_ACTIVE:()=>Kv,CLASS_INSPECTOR_CLOSE:()=>qv,CLASS_INSPECTOR_INACTIVE:()=>Np,CLASS_LABEL_OVERLAY:()=>pS,CLASS_LASSO:()=>NT,CLASS_LASSO_MASK:()=>nh,CLASS_LASSO_MASK_BOTTOM:()=>GT,CLASS_LASSO_MASK_LEFT:()=>IT,CLASS_LASSO_MASK_RIGHT:()=>VT,CLASS_LASSO_MASK_TOP:()=>MT,CLASS_LINE_CHART:()=>kP,CLASS_MINIVIEW:()=>Xu,CLASS_MINIVIEW_CANVAS:()=>$T,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>YT,CLASS_MINIVIEW_COLLAPSE:()=>zT,CLASS_MINIVIEW_COLLAPSED:()=>ju,CLASS_MINIVIEW_ELEMENT:()=>FT,CLASS_MINIVIEW_GROUP_ELEMENT:()=>UT,CLASS_MINIVIEW_PANNER:()=>BT,CLASS_MINIVIEW_PANNING:()=>bf,CLASS_MOST_RECENTLY_DRAGGED:()=>rh,CLASS_NODE:()=>$i,CLASS_ORTHOGONAL_HANDLE:()=>KC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>Qp,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>QC,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>qC,CLASS_OVERLAY:()=>Ws,CLASS_OVERLAY_HIDE:()=>Il,CLASS_PALETTE:()=>Ty,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>Hu,CLASS_PALETTE_DRAG_ACTIVE:()=>jT,CLASS_PALETTE_DRAG_HOVER:()=>HT,CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP:()=>kT,CLASS_PALETTE_ELEMENT_CURRENT:()=>WT,CLASS_PALETTE_SELECTED_ELEMENT:()=>jo,CLASS_PALETTE_SET:()=>kp,CLASS_PALETTE_SET_FILTER:()=>Gh,CLASS_PALETTE_SET_SHAPES:()=>Cy,CLASS_PALETTE_SET_TITLE:()=>IC,CLASS_PALETTE_SHAPE:()=>$h,CLASS_PALETTE_SHAPE_LABEL:()=>vy,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>ih,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>MC,CLASS_PAN_ZOOM_CANVAS:()=>CL,CLASS_PAN_ZOOM_VIEWPORT:()=>vL,CLASS_PAPER:()=>ET,CLASS_PAPER_CANVAS:()=>fT,CLASS_PAPER_NODE:()=>SV,CLASS_PIE_CHART:()=>ED,CLASS_PIE_SLICE:()=>Rg,CLASS_PIE_SLICE_SELECTED:()=>fO,CLASS_PORT:()=>gS,CLASS_RESIZE_BORDER:()=>rs,CLASS_RESIZE_BORDER_BOTTOM:()=>SC,CLASS_RESIZE_BORDER_LEFT:()=>vC,CLASS_RESIZE_BORDER_RIGHT:()=>CC,CLASS_RESIZE_BORDER_TOP:()=>TC,CLASS_RESIZE_FRAME:()=>AC,CLASS_RESIZE_HANDLE:()=>At,CLASS_RESIZE_HANDLE_ACTIVE:()=>ny,CLASS_RESIZE_HANDLE_B:()=>hy,CLASS_RESIZE_HANDLE_BL:()=>oy,CLASS_RESIZE_HANDLE_BR:()=>ay,CLASS_RESIZE_HANDLE_L:()=>cy,CLASS_RESIZE_HANDLE_R:()=>dy,CLASS_RESIZE_HANDLE_T:()=>ly,CLASS_RESIZE_HANDLE_TL:()=>iy,CLASS_RESIZE_HANDLE_TR:()=>sy,CLASS_RESIZE_SKELETON:()=>yC,CLASS_RESIZE_SKELETON_BORDERS:()=>xC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>bC,CLASS_ROTATE_HANDLE:()=>Ih,CLASS_ROTATE_LEADER:()=>zp,CLASS_SANKEY_CHART:()=>xD,CLASS_SANKEY_EDGE:()=>ix,CLASS_SANKEY_LABEL:()=>sx,CLASS_SANKEY_NODE:()=>ox,CLASS_SANKEY_SELECTED:()=>so,CLASS_SANKEY_UNSELECTED:()=>Zr,CLASS_SCATTER_CHART:()=>FP,CLASS_SCATTER_CHART_DATA_POINT:()=>UP,CLASS_SELECTED_MODE:()=>A1,CLASS_SELECT_DEFEAT:()=>gt,CLASS_SHAPE:()=>ch,CLASS_SHAPE_ICON:()=>tp,CLASS_SHAPE_LABEL:()=>Wu,CLASS_SNAPLINE:()=>Fp,CLASS_SNAPLINE_ACTIVE:()=>lC,CLASS_SNAPLINE_ACTIVE_EXACT:()=>hC,CLASS_SNAPLINE_EXACT:()=>ey,CLASS_SNAPLINE_HORIZONTAL:()=>aC,CLASS_SNAPLINE_VERTICAL:()=>sC,CLASS_SOURCE_HOVER:()=>vf,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>Ry,CLASS_STRAIGHT_DELETE_HANDLE:()=>tg,CLASS_STRAIGHT_DRAG_HANDLE:()=>ss,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>tP,CLASS_STRAIGHT_HANDLE:()=>Fh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>eg,CLASS_SURFACE:()=>cf,CLASS_SURFACE_CANVAS:()=>uf,CLASS_SURFACE_DIRECT:()=>RT,CLASS_SURFACE_EDGE_DRAGGING:()=>Dn,CLASS_SURFACE_ELEMENT_DRAGGING:()=>ff,CLASS_SURFACE_ELEMENT_FLASH:()=>mf,CLASS_SURFACE_NO_PAN:()=>df,CLASS_SURFACE_PAN:()=>pf,CLASS_SURFACE_PANNING:()=>Ef,CLASS_SURFACE_PAN_ACTIVE:()=>gf,CLASS_SURFACE_PAN_BOTTOM:()=>IV,CLASS_SURFACE_PAN_LEFT:()=>wV,CLASS_SURFACE_PAN_RIGHT:()=>NV,CLASS_SURFACE_PAN_TOP:()=>DV,CLASS_SURFACE_POINTER_DEVICE:()=>wT,CLASS_SURFACE_TOUCH_DEVICE:()=>LT,CLASS_TARGET_HOVER:()=>Cf,CLASS_TOGGLE_GROUP_COLLAPSE:()=>su,CLASS_TRANSIENT_VERTEX:()=>ZT,CLASS_UI_SELECTED_CONNECTION:()=>Ml,CLASS_UI_SELECTED_ELEMENT:()=>Bi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>ry,CLASS_VERTEX_DRAWING_LASSO:()=>cC,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>jp,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>by,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Vh,CLASS_VJS_ANIMATE_SOURCE:()=>yy,CLASS_VJS_ANIMATE_TARGET:()=>xy,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>k1,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>W1,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Bn,CLASS_VJS_TOOLTIP:()=>tD,CLEAR_PATH:()=>p0,CLEAR_VIEW_BOX:()=>u0,COLOR_PICKER_ELEMENT:()=>P0,COMMIT_CURRENT:()=>e_,COMPONENT_TYPE_CONNECTION:()=>GE,CONNECTION:()=>aV,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Po,CONNECTOR_TYPE_ORTHOGONAL:()=>Xs,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>Hd,CONNECTOR_TYPE_SMOOTH:()=>zA,CONNECTOR_TYPE_STRAIGHT:()=>Cn,CONNECT_REASON_API:()=>nl,CONNECT_REASON_COPY_PASTE:()=>wx,CONNECT_REASON_DATA_LOAD:()=>il,CONNECT_REASON_TRANSIENT:()=>Lx,CONNECT_REASON_UNDO_REDO:()=>Rx,CONNECT_REASON_USER_ACTIVITY:()=>co,CONTAINMENT_NOT_NEGATIVE:()=>sw,CONTAINMENT_PARENT:()=>aw,CONTAINMENT_PARENT_ENCLOSED:()=>lw,CONTENT_TYPES:()=>ya,CSV:()=>_N,CandidateSorter:()=>Xc,CanvasLayoutAdapter:()=>rp,CatchAllEventHandler:()=>ed,CategoryValueChart:()=>Yn,CategoryValueTooltip:()=>$a,CategoryVsAxisPlot:()=>oo,ChartExporter:()=>fg,ChartLegend:()=>mg,ChartSeries:()=>Ar,CircularLayout:()=>Pc,ClickSplitMode:()=>rg,Clipboard:()=>Gd,Cluster:()=>mc,CollationSeries:()=>Na,Collicat:()=>ng,ColumnChart:()=>dO,ColumnLayout:()=>sl,CommentEntry:()=>Gs,Components:()=>Le,CompoundAction:()=>Eo,Connections:()=>Wt,Connectors:()=>Ve,ControlsComponent:()=>vp,ControlsPlugin:()=>Lh,CopyData:()=>Vd,CopyPasteControlsComponent:()=>Yv,CrossingStage:()=>As,CsvReader:()=>Im,CustomOverlayImpl:()=>kE,CustomTag:()=>Od,DEFAULT:()=>xe,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>Av,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>Qw,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>qw,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>Kw,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>Jw,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>Ww,DEFAULT_ARRAY_SERIES_STEP:()=>kw,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>Zw,DEFAULT_AXIS_LINE_SIZE:()=>Ei,DEFAULT_BACKGROUND_COLOR:()=>Uw,DEFAULT_BAR_GAP:()=>hD,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>_A,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>w_,DEFAULT_BORDER_HANDLE_SIZE:()=>pC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>oO,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>sO,DEFAULT_CATEGORY_FILL_RATIO:()=>aD,DEFAULT_CHART_EMPTY_MESSAGE:()=>QP,DEFAULT_CHART_ERROR_MESSAGE:()=>eO,DEFAULT_COLOR:()=>lv,DEFAULT_COLOR_PROPERTY:()=>Df,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>bv,DEFAULT_CORNER_RADIUS:()=>Tg,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>FC,DEFAULT_DIAGRAM_CELL_WIDTH:()=>BC,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>F0,DEFAULT_DOT_OVERLAY_RADIUS:()=>RR,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Rp,DEFAULT_EDGE_NODE_SIZE:()=>gm,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>DR,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>NR,DEFAULT_EXPORT_FILENAME:()=>_p,DEFAULT_FILL_COLOR:()=>mh,DEFAULT_FILL_PROPERTY:()=>wf,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>cw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>hw,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>uw,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>dw,DEFAULT_GRID:()=>ML,DEFAULT_GRID_LINE_COLOR:()=>tO,DEFAULT_HANDLE_OFFSET:()=>EC,DEFAULT_HEIGHT_ATTRIBUTE:()=>Yx,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>jx,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>Wx,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>Hx,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>kx,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>Ic,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>vE,DEFAULT_KEY_ANCHOR:()=>Vl,DEFAULT_KEY_ANCHORS:()=>Gl,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>ES,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>fS,DEFAULT_KEY_CONNECTOR:()=>lu,DEFAULT_KEY_CSS_CLASS:()=>yS,DEFAULT_KEY_EDGES_DETACHABLE:()=>XI,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>xS,DEFAULT_KEY_GROUP_SIZE:()=>jI,DEFAULT_KEY_HOVER_CLASS:()=>bS,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>hu,DEFAULT_KEY_MAX_CONNECTIONS:()=>AS,DEFAULT_KEY_NODE_SIZE:()=>HI,DEFAULT_KEY_PAINT_STYLE:()=>Vo,DEFAULT_KEY_REATTACH_EDGES:()=>kI,DEFAULT_KEY_SCOPE:()=>CE,DEFAULT_LABEL_COLOR:()=>zw,DEFAULT_LABEL_FILL_RATIO:()=>pL,DEFAULT_LABEL_LOCATION:()=>OR,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>RE,DEFAULT_LABEL_PROPERTY:()=>ki,DEFAULT_LEFT_ATTRIBUTE:()=>Bx,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>Hw,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>jw,DEFAULT_LEGEND_PADDING:()=>Gw,DEFAULT_LINE_STROKE:()=>Th,DEFAULT_MARGIN:()=>Yw,DEFAULT_MAXIMUM_BAR_WIDTH:()=>lD,DEFAULT_MINIMUM_HEIGHT:()=>mC,DEFAULT_MINIMUM_WIDTH:()=>gC,DEFAULT_ORTHOGONAL_STUB:()=>YA,DEFAULT_OUTLINE_COLOR:()=>ko,DEFAULT_OUTLINE_PROPERTY:()=>ph,DEFAULT_OUTLINE_WIDTH:()=>Eh,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>gh,DEFAULT_PALETTE_SELECTOR:()=>I0,DEFAULT_PAPER_MARGIN:()=>yT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>wR,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>LR,DEFAULT_ROTATE_HANDLE_SIZE:()=>uC,DEFAULT_ROTATE_LEADER_LENGTH:()=>dC,DEFAULT_ROTATION_ATTRIBUTE:()=>Ux,DEFAULT_SET_DESCRIPTION:()=>$V,DEFAULT_SET_NAME:()=>GV,DEFAULT_SHAPE_SETS:()=>UC,DEFAULT_SMOOTHING:()=>K_,DEFAULT_SVG_HANDLE_SIZE:()=>Up,DEFAULT_TICK_LINE_STROKE:()=>wv,DEFAULT_TICK_MARKS_PER_CELL:()=>VL,DEFAULT_TITLE_PADDING:()=>qy,DEFAULT_TOP_ATTRIBUTE:()=>Fx,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>vg,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>Cg,DEFAULT_VALUE_AXIS_PADDING:()=>iO,DEFAULT_WIDTH_ATTRIBUTE:()=>zx,DEFAULT_ZOOM_RANGE:()=>SS,DIAGONAL_AXIS_LR:()=>En,DIAGONAL_AXIS_RL:()=>kn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>Pa,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>oC,DataModel:()=>vc,DataSeriesBasedDataSource:()=>yg,Decorator:()=>hp,Decorators:()=>cp,DefaultRouter:()=>Fl,DefaultSearchTokenizer:()=>l_,Diagram:()=>Jp,DiagramCell:()=>Fn,DiagramExportComponent:()=>HC,DiagramLink:()=>di,DiagramPalette:()=>Bh,DiagramToolsPlugin:()=>os,DialogConstants:()=>Ae,DiamondOverlay:()=>Ou,DotOverlay:()=>_u,Drag:()=>Ny,DragGroupsPlugin:()=>Qo,DualValueAxisTooltip:()=>Pg,DualValueChart:()=>Ya,DualValueChartSeries:()=>za,EDGE:()=>Tr,EDGE_DRAG_HANDLE:()=>Mn,EDGE_INPUT_METHOD_CLICK:()=>Ah,EDGE_INPUT_METHOD_DRAG:()=>Zi,EDGE_INPUT_STATE_IDLE:()=>Sh,EDGE_INPUT_STATE_LOCKED:()=>Mf,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>Dv,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>b1,EDGE_SNAP_CENTER:()=>d1,EDGE_SNAP_DEFAULT:()=>gv,EDGE_SNAP_PERIMETER:()=>PL,EDGE_TYPE_PICKER_ELEMENT:()=>L0,EDGE_UPDATE_REASON_UPDATED:()=>Zb,ELEMENT:()=>sV,ELEMENT_CIRCLE:()=>Xe,ELEMENT_DEFS:()=>XS,ELEMENT_DIV:()=>We,ELEMENT_ELLIPSE:()=>jS,ELEMENT_G:()=>q,ELEMENT_INCLUDE_ICON:()=>dL,ELEMENT_INCLUDE_ICONS:()=>uL,ELEMENT_PATH:()=>te,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>Pe,ELEMENT_TEXT:()=>Qe,ELEMENT_TSPAN:()=>BE,EMPTY_ASTAR_PATH:()=>ym,EMPTY_BOUNDS:()=>xi,EMPTY_ELEMENT:()=>rR,EVENT_ADHOC_LAYOUT:()=>Eb,EVENT_AFTER_LAYOUT_REFRESH:()=>Ds,EVENT_BEFORE_START:()=>uP,EVENT_CANVAS_CLICK:()=>yo,EVENT_CANVAS_DBLCLICK:()=>$b,EVENT_CHANGE:()=>Ip,EVENT_CHART_LOAD:()=>Eg,EVENT_CLICK:()=>Fe,EVENT_CONTEXTMENU:()=>xt,EVENT_CONTEXT_UPDATE:()=>gl,EVENT_DATA_APPEND_END:()=>Sm,EVENT_DATA_APPEND_START:()=>Am,EVENT_DATA_LOAD_END:()=>Ir,EVENT_DATA_LOAD_START:()=>mo,EVENT_DATA_UPDATED:()=>Tm,EVENT_DBLCLICK:()=>fo,EVENT_DBLTAP:()=>Br,EVENT_DESELECT:()=>lr,EVENT_DESTROY:()=>Oi,EVENT_DRAG:()=>pP,EVENT_DROP:()=>nw,EVENT_EDGE_ADDED:()=>sr,EVENT_EDGE_CLICK:()=>Db,EVENT_EDGE_CONTEXTMENU:()=>Vb,EVENT_EDGE_DBLCLICK:()=>Nb,EVENT_EDGE_DBLTAP:()=>Ib,EVENT_EDGE_GEOMETRY:()=>Zn,EVENT_EDGE_MOUSEDOWN:()=>El,EVENT_EDGE_MOUSEOUT:()=>yd,EVENT_EDGE_MOUSEOVER:()=>xd,EVENT_EDGE_MOUSEUP:()=>Mb,EVENT_EDGE_PATH_EDITED:()=>Jn,EVENT_EDGE_REDRAW:()=>bd,EVENT_EDGE_REMOVED:()=>yt,EVENT_EDGE_SOURCE_CHANGED:()=>Qr,EVENT_EDGE_TAP:()=>Gb,EVENT_EDGE_TARGET_CHANGED:()=>qr,EVENT_EDGE_TYPE_CHANGED:()=>jc,EVENT_EDGE_UPDATED:()=>ft,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>jf,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>Xf,EVENT_END_NODE_TRAVERSAL:()=>wC,EVENT_END_OVERLAY_ANIMATION:()=>qi,EVENT_FOCUS:()=>xb,EVENT_GRAPH_CHANGED:()=>nb,EVENT_GRAPH_CLEARED:()=>Ht,EVENT_GRAPH_CLEAR_START:()=>yn,EVENT_GROUP_ADDED:()=>jt,EVENT_GROUP_COLLAPSE:()=>pd,EVENT_GROUP_EXPAND:()=>gd,EVENT_GROUP_MEMBER_ADDED:()=>Pi,EVENT_GROUP_MEMBER_REMOVED:()=>Cs,EVENT_GROUP_MOVE:()=>Zc,EVENT_GROUP_MOVE_END:()=>Vr,EVENT_GROUP_MOVE_START:()=>ib,EVENT_GROUP_RELAYOUT:()=>ml,EVENT_GROUP_REMOVED:()=>Ie,EVENT_GROUP_RENDERED:()=>Gr,EVENT_GROUP_TYPE_CHANGED:()=>Wc,EVENT_GROUP_UPDATED:()=>_e,EVENT_INTERNAL_CONNECTION:()=>mb,EVENT_INTERNAL_ELEMENT_REPAINTED:()=>ud,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>Jc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>Kc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>qc,EVENT_INTERNAL_VERTEX_UPDATED:()=>Ns,EVENT_KEYUP:()=>Nn,EVENT_LASSO_END:()=>Bb,EVENT_MOUSEDOWN:()=>pe,EVENT_MOUSEENTER:()=>Lm,EVENT_MOUSEEXIT:()=>wm,EVENT_MOUSELEAVE:()=>bb,EVENT_MOUSEMOVE:()=>oe,EVENT_MOUSEOUT:()=>it,EVENT_MOUSEOVER:()=>ot,EVENT_MOUSEUP:()=>se,EVENT_NODE_ADDED:()=>kt,EVENT_NODE_MOVE:()=>er,EVENT_NODE_MOVE_ABORT:()=>Qc,EVENT_NODE_MOVE_END:()=>It,EVENT_NODE_MOVE_START:()=>Ps,EVENT_NODE_REMOVED:()=>Re,EVENT_NODE_RENDERED:()=>$r,EVENT_NODE_TYPE_CHANGED:()=>Hc,EVENT_NODE_UPDATED:()=>Me,EVENT_NODE_VISIBILITY:()=>Ed,EVENT_OBJECT_REPAINTED:()=>yb,EVENT_OUT:()=>ow,EVENT_OVER:()=>iw,EVENT_PAN:()=>fl,EVENT_PLUGIN_ADDED:()=>fd,EVENT_PLUGIN_REMOVED:()=>fb,EVENT_PORT_ADDED:()=>Wn,EVENT_PORT_REMOVED:()=>Mr,EVENT_PORT_TYPE_CHANGED:()=>kc,EVENT_PORT_UPDATED:()=>or,EVENT_REDO:()=>ab,EVENT_RELAYOUT:()=>bn,EVENT_RENDERER_ADDED:()=>ob,EVENT_RENDER_END:()=>xn,EVENT_RENDER_START:()=>md,EVENT_SELECT:()=>ar,EVENT_SELECTION_CLEARED:()=>vr,EVENT_START:()=>dP,EVENT_START_NODE_TRAVERSAL:()=>fy,EVENT_START_OVERLAY_ANIMATION:()=>Mh,EVENT_STATE:()=>Xp,EVENT_STOP:()=>gP,EVENT_SURFACE_MODE_CHANGED:()=>An,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>Sb,EVENT_TOUCHMOVE:()=>Tb,EVENT_TOUCHSTART:()=>Ab,EVENT_UNDO:()=>sb,EVENT_UNDOREDO_UPDATE:()=>Os,EVENT_VERTEX_CLICK:()=>vb,EVENT_VERTEX_CONTEXTMENU:()=>Lb,EVENT_VERTEX_DBLCLICK:()=>Cb,EVENT_VERTEX_DBLTAP:()=>Pb,EVENT_VERTEX_MOUSEDOWN:()=>AN,EVENT_VERTEX_MOUSEMOVE:()=>Rb,EVENT_VERTEX_MOUSEOUT:()=>Ob,EVENT_VERTEX_MOUSEOVER:()=>_b,EVENT_VERTEX_MOUSEUP:()=>bN,EVENT_VERTEX_TAP:()=>wb,EVENT_ZOOM:()=>Kn,EachEntry:()=>Pd,Edge:()=>Be,EdgeGeometryTransformer:()=>ip,EdgeHandlerBase:()=>ca,EdgeInputHandler:()=>mp,EdgePathEditor:()=>ua,EdgeRelocateHandler:()=>Ep,EdgeRoutingPlugin:()=>Ph,EdgeRoutingStage:()=>Vc,EdgeTypePicker:()=>Gp,EditorBase:()=>Ji,ElasticGroupManager:()=>Ea,ElementCluster:()=>um,ElementDragHandler2:()=>Kp,ElementDragger:()=>fP,ElementEntry:()=>Fr,ElementTypes:()=>Mi,Elements:()=>ei,EllipseOverlay:()=>Lu,EmptyLayout:()=>ys,EmptyRedrawResult:()=>pu,EventGenerator:()=>em,EventManager:()=>fe,ExportControlsPlugin:()=>Bp,FACE_BOTTOM:()=>Ot,FACE_LEFT:()=>Ct,FACE_RIGHT:()=>Pt,FACE_TOP:()=>vt,FALSE:()=>ct,FILL:()=>zS,FIXED:()=>yE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>mw,FLOWCHART_EDGE_TYPE_DASHED:()=>fw,FLOWCHART_EDGE_TYPE_PLAIN:()=>Ew,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>pw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>gw,FLOWCHART_SHAPES:()=>KV,FixedLayer:()=>lp,FlowchartBasicEdgeMappings:()=>zG,ForceDirectedLayout:()=>Rc,GRID_TYPE_DOTTED:()=>E1,GRID_TYPE_LINES:()=>f1,GROUP_RELAYOUT_ADHOC:()=>Fb,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>zb,GROUP_RELAYOUT_MEMBER_REMOVED:()=>TN,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>Ub,GaugeChart:()=>mO,GeneratedGridBackground:()=>ga,Graph:()=>rl,GridLayout:()=>po,GridProfile:()=>Ul,GridTypes:()=>IL,Group:()=>ie,GroupCollapseAction:()=>cd,GroupExpandAction:()=>dd,GroupLayoutAdapter:()=>np,GroupRemoveAction:()=>nd,GroupSizeChangedAction:()=>ul,H:()=>Ix,HEIGHT:()=>De,HIERARCHICAL_JSON_DATATYPE:()=>qg,HTMLElementOverlay:()=>ql,HeadlessRecado:()=>Zm,HierarchicalLayout:()=>Dc,HierarchicalParentRelativePlacementStrategy:()=>wc,HierarchyLayout:()=>go,HierarchyLayoutModel:()=>Gc,HierarchyLayoutStage:()=>bs,HilbertCurves:()=>$s,ICONS_ORIENTATION_HORIZONTAL:()=>av,ICONS_ORIENTATION_VERTICAL:()=>WV,ICON_CIRCLE:()=>ev,ICON_CLONE:()=>Ju,ICON_CROSS:()=>qT,ICON_GEAR:()=>tv,ICON_LINK:()=>Zu,ICON_ORIGIN_CENTER:()=>lh,ICON_ORIGIN_END:()=>hh,ICON_ORIGIN_START:()=>ah,ICON_PLUS:()=>QT,ICON_TRASH:()=>Ku,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>w0,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Rh,IconElement:()=>Rf,IfEntry:()=>Rd,ImageExportUI:()=>_h,InBrowserTemplateResolver:()=>_f,Index:()=>rA,Inspector:()=>Mp,JSON_DATATYPE:()=>Xt,LASSO_PATH:()=>o0,LASSO_VIEW_BOX:()=>i0,LAYOUT_TYPE_ABSOLUTE:()=>$O,LAYOUT_TYPE_COLUMN:()=>am,LAYOUT_TYPE_GRID:()=>sm,LAYOUT_TYPE_HIERARCHICAL:()=>jO,LAYOUT_TYPE_HIERARCHY:()=>Jx,LAYOUT_TYPE_ROW:()=>lm,LEFT:()=>ze,LEGEND_ALIGN_CENTER:()=>Zy,LEGEND_ALIGN_LEFT:()=>Wy,LEGEND_ALIGN_RIGHT:()=>qP,LEGEND_ORIENTATION_HORIZONTAL:()=>ky,LEGEND_ORIENTATION_VERTICAL:()=>A$,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>Jy,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>rc,LEGEND_VERTICAL_ALIGN_TOP:()=>tc,LINE_WIDTH:()=>PM,LOCATION_ATTRIBUTE:()=>gR,LabelOverlay:()=>pr,Lasso:()=>pa,LassoPlugin:()=>Vn,Layouts:()=>rt,LineChart:()=>EO,LinePlot:()=>cc,ListManagerPlugin:()=>Dh,MagnetizeProfile:()=>Tu,Magnetizer:()=>Ti,MiniviewPlugin:()=>Gn,ModelSeriesBasedDataSource:()=>oc,MoveAction:()=>Ls,NEGATIVE:()=>Gx,NOMINAL_SIZE:()=>On,NONE:()=>pt,Node:()=>de,NodeGroupAction:()=>rd,OBJECT_TYPE_ANCHOR:()=>tE,OPPOSITE_FACES:()=>nI,ORIENTATION_OPPOSITE:()=>dE,ORIENTATION_ORTHOGONAL:()=>cE,ORIENTATION_PERPENDICULAR:()=>hE,ORTHOGONAL_AXIS_HORIZONTAL:()=>re,ORTHOGONAL_AXIS_VERTICAL:()=>ue,ORTHOGONAL_FACES:()=>rI,ORTHOGONAL_ROUTER_MODE_BUS:()=>QN,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>Id,OVERLAY_TYPE_CUSTOM:()=>HE,OVERLAY_VISIBILITY_ALWAYS:()=>cu,OVERLAY_VISIBILITY_HOVER:()=>Fi,OptimisticEventGenerator:()=>Vt,OrthogonalEditor:()=>eo,Overlay:()=>ni,OverlayFactory:()=>at,PALETTE_MODE_DRAG:()=>Kf,PALETTE_MODE_DRAW:()=>qf,PALETTE_MODE_TAP:()=>iC,PAN_PATH:()=>h0,PAN_VIEW_BOX:()=>l0,PAPER_ALIGN_CENTER:()=>Yo,PAPER_ALIGN_END:()=>Kl,PAPER_ALIGN_START:()=>Jl,PATH_CONSTRAIN_DIAGONAL:()=>_c,PATH_CONSTRAIN_MANHATTAN:()=>Mx,PATH_CONSTRAIN_METRO:()=>Vx,PATH_CONSTRAIN_NONE:()=>Jr,PATH_CONSTRAIN_ORTHOGONAL:()=>Kr,PLACEHOLDER_KEY:()=>Sl,PLACEHOLDER_VALUE:()=>bo,POSITION_RELATIVE:()=>aS,PROPERTY_POSITION:()=>of,PX:()=>Pn,Palette:()=>Aa,PalettePlugin:()=>wh,PanButtonsPlugin:()=>ts,PanZoom:()=>ha,Paper:()=>Yh,ParentRelativePlacementStrategy:()=>Bc,PathImpl:()=>ol,PathTransport:()=>Yp,PathTransportState:()=>LC,PerimeterAnchorShapes:()=>R_,PieChart:()=>yO,PinchListener:()=>ap,PlacementStage:()=>Fc,PlainArrowOverlay:()=>Pu,Port:()=>he,PortAction:()=>od,PortAddAction:()=>sd,PortRemoveAction:()=>ad,PriorityQueue:()=>gs,PropertyMapper:()=>wu,PropertyTracker:()=>Su,QuadraticBezierEditor:()=>ro,REMOVE_CLASS_ACTION:()=>yM,RESET_SELECTION_PATH:()=>d0,RESET_SELECTION_VIEW_BOX:()=>c0,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>fC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>Nh,RIGHT:()=>Et,ROLLBACK_CURRENT:()=>t_,ROOT_SHAPE_SET:()=>Wi,ROTATION:()=>nN,ROW:()=>vi,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>bA,RTree:()=>Bs,RandomColorGenerator:()=>Ss,Recado:()=>So,RecadoTemplateRenderer:()=>sp,RecordBasedSeries:()=>Kt,RectangleOverlay:()=>Ru,RemoveGroupMemberAction:()=>hd,ResizingToolsPlugin:()=>is,RowLayout:()=>al,SEGMENT_TYPE_ARC:()=>_l,SEGMENT_TYPE_BEZIER:()=>Co,SEGMENT_TYPE_STRAIGHT:()=>vn,SELECTION_MODE_EDGES_ONLY:()=>db,SELECTION_MODE_GROUPS_ONLY:()=>cb,SELECTION_MODE_ISOLATED:()=>td,SELECTION_MODE_MIXED:()=>lb,SELECTION_MODE_NODES_ONLY:()=>hb,SELECTOR_CONNECTOR:()=>Hr,SELECTOR_GROUP_CONTAINER:()=>rT,SELECTOR_MANAGED_ELEMENT:()=>Xl,SELECTOR_OVERLAY:()=>Ln,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>nT,SOURCE:()=>nt,STATIC:()=>sS,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>CG,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>rP,STROKE:()=>$E,STROKE_WIDTH:()=>YS,SURFACE_MODE_DISABLED:()=>Zo,SURFACE_MODE_PAN:()=>yr,SURFACE_MODE_SELECT:()=>hi,SURFACE_MODE_VERTEX_DRAWING:()=>In,SVGElementOverlay:()=>Fu,SVG_NAMESPACE:()=>Mt,SankeyChart:()=>SO,ScatterChart:()=>TO,Segments:()=>cr,SelectedEdgeHighlightPlugin:()=>ma,SeriesBasedChart:()=>Ma,ShapeLibraryDefaults:()=>ku,ShapeLibraryImpl:()=>ra,ShapePalette:()=>Zp,ShapeTypeInspector:()=>nC,SimpleBackground:()=>xp,SimpleShapeOverlay:()=>_n,SingleColorGenerator:()=>zc,SnaplinesPlugin:()=>es,SourceValueTargetCsvParser:()=>eA,StaticColorGenerator:()=>Kx,Storage:()=>EP,StraightEditor:()=>to,StraightSegmentHandler:()=>_o,SummingSeries:()=>Ia,Surface:()=>zh,SurfaceAnimator:()=>Hp,SvgComponent:()=>zu,SvgExportComponent:()=>ba,SvgExportUI:()=>wp,SyntheticDecorator:()=>xh,TAG_SHAPE:()=>KT,TARGET:()=>fn,TILING_STRATEGY_ABSOLUTE:()=>Rv,TILING_STRATEGY_LOGARITHMIC:()=>_v,TOP:()=>Se,TRUE:()=>Tt,TWO_PI:()=>fi,TYPE_ATTRIBUTE:()=>lA,TYPE_EACH:()=>Qn,TYPE_ELEMENT:()=>qn,TYPE_IF:()=>Al,TYPE_ITEM_ANCHORS:()=>Eu,TYPE_ITEM_CONNECTOR:()=>IE,TYPE_ITEM_OVERLAY:()=>OS,TYPE_JPG:()=>qo,TYPE_PNG:()=>Oh,TYPE_ROOT:()=>oA,TYPE_SVG:()=>Zf,TYPE_TEXT:()=>Li,TYPE_TMPL:()=>xo,TerminusAddAction:()=>dl,TerminusRemoveAction:()=>cl,TestHarness:()=>lg,TextEntry:()=>Ni,TiledBackground:()=>bp,TmplEntry:()=>Ao,Tooltip:()=>Va,TooltipRenderer:()=>Ga,UICore:()=>Cu,UIModel:()=>uu,UIPlugins:()=>tn,UIState:()=>Sp,UNDEFINED:()=>$x,UiStatesBrowserUIModel:()=>zf,UiStatesPlugin:()=>Ch,UndoRedoManager:()=>Ad,UpdateAction:()=>Ri,UrlSeriesBasedDataSource:()=>xg,V:()=>Oc,VERTEX:()=>ll,VERTEX_DRAWING_PATH:()=>a0,VERTEX_DRAWING_VIEW_BOX:()=>s0,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>i_,VERTEX_UPDATE_REASON_ADD_PORT:()=>n_,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>xl,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>Jb,VERTEX_UPDATE_REASON_LAYOUT:()=>PN,VERTEX_UPDATE_REASON_MAGNETIZER:()=>Kb,VERTEX_UPDATE_REASON_MOVED:()=>Vs,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>o_,VERTEX_UPDATE_REASON_RESIZED:()=>Qb,VERTEX_UPDATE_REASON_ROTATION:()=>Is,VERTEX_UPDATE_REASON_SET_POSITION:()=>vd,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>ON,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>qb,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>Wb,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>kb,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>Sd,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>Nm,VanillaInspector:()=>$p,Vertex:()=>Sc,VertexDrawingPlugin:()=>ci,VertexSet:()=>Uc,Viewport:()=>gu,VisuallyJsModel:()=>Td,VisuallyJsRendererVertexRemovedAction:()=>pl,VisuallyJsSelection:()=>hr,VisuallyJsTestSupport:()=>pi,VjsContext:()=>tu,WIDTH:()=>ve,WILDCARD:()=>ur,WhitespaceReplacingTokenizer:()=>wN,X:()=>Q,XHTML_NAMESPACE:()=>BM,XLINK_NAMESPACE:()=>$M,XYChart:()=>Ba,XYPlot:()=>Qy,X_AXIS_FACES:()=>eI,Y:()=>Ee,Y_AXIS_FACES:()=>tI,ZOOM_IN_OUT_VIEW_BOX:()=>Hv,ZOOM_IN_PATH:()=>g0,ZOOM_OUT_PATH:()=>m0,ZOOM_TO_FIT_PATH:()=>n0,ZOOM_TO_FIT_VIEW_BOX:()=>r0,_addBinding:()=>Gm,_addConnectorSegment:()=>zr,_adjustForGap:()=>US,_applyStyles:()=>tf,_areaIfGrownBy:()=>AA,_bindOneAtt:()=>hA,_calculateSteps:()=>Xy,_clearConnectorSegments:()=>sE,_computeConnector:()=>vI,_computeSingleLocation:()=>xu,_connectorBoundingBoxIntersection:()=>FA,_connectorBoxIntersection:()=>PI,_connectorGradientAtPoint:()=>TI,_connectorLineIntersection:()=>CI,_connectorPointAlongPathFrom:()=>Ye,_connectorPointOnPath:()=>dr,_createAnchor:()=>NE,_createBaseSegment:()=>Us,_createConnectorBase:()=>$d,_createContinuousAnchor:()=>CS,_createCubicBezierConnector:()=>z_,_createQuadraticBezierConnector:()=>Y_,_createSegment:()=>vA,_defaultGroupHtmlTemplate:()=>mL,_defaultGroupSvgTemplate:()=>fL,_defaultNodeHtmlTemplate:()=>sa,_defaultNodeSvgTemplate:()=>aa,_defaultPortHtmlTemplate:()=>gL,_defaultPortSvgTemplate:()=>EL,_defaultSegmentBoundingBoxIntersection:()=>OA,_defaultSegmentBoxIntersection:()=>Cl,_defaultSegmentFindClosestPointOnPath:()=>CA,_defaultSegmentLineIntersection:()=>PA,_emptyRTreeRegion:()=>To,_findAnchorOrientation:()=>gp,_findConnectorSegmentForLocation:()=>oE,_findConnectorSegmentForPoint:()=>BA,_findIdealSteps:()=>Mw,_findNextHorizontalSegment:()=>XA,_findNextSegmentOfType:()=>kd,_findNextVerticalSegment:()=>HA,_findPreviousHorizontalSegment:()=>jA,_findPreviousVerticalSegment:()=>kA,_findTargetZones:()=>_L,_findZones:()=>RL,_getCurrentAnchorLocation:()=>GS,_getDefaultTemplate:()=>cv,_getLabelOverlay:()=>dM,_getSegmentLength:()=>nE,_getVertexInfo:()=>up,_growToFit:()=>Km,_hasLeafNodes:()=>SA,_hideOverlays:()=>ER,_initialiseDecorators:()=>pv,_internalLabelOverlayClass:()=>LS,_internalLabelOverlayId:()=>fu,_internalSourceMarkerOverlayId:()=>lM,_internalTargetMarkerOverlayId:()=>hM,_isContinuousAnchor:()=>Bo,_isFaceAvailable:()=>$l,_isLeaf:()=>Md,_mapToSpline:()=>mE,_padPoint:()=>xM,_placeAnchorsOnLine:()=>VS,_populateSourceZones:()=>Ev,_populateTargetZones:()=>bh,_populateZones:()=>mv,_prepareCompute:()=>lE,_registerSegmentHandler:()=>Fs,_removeOverlay:()=>$o,_removeShortSegments:()=>q_,_removeTypeCssHelper:()=>NS,_resetConnectorBounds:()=>$A,_resetConnectorGeometry:()=>Ii,_setAnchorLocation:()=>iE,_setOrthogonalSegmentPosition:()=>iS,_showOverlays:()=>fR,_trimOrthogonalConnector:()=>oS,_trimOrthogonalSegments:()=>fE,_trimSegments:()=>EE,_updateConnectorBounds:()=>B_,_updateConnectorSegmentProportions:()=>aE,_updateHoverStyle:()=>yu,_updateRTreeRegionBounds:()=>qm,_writeSegmentedConnectorSegments:()=>Kd,aSegmentDirections:()=>Oo,add:()=>yi,addClass:()=>L,addConnectionClass:()=>jr,addEntryToEachExecution:()=>Ym,addNewExecutionToEachExecution:()=>mA,addSegment:()=>Ol,addToDictionary:()=>fx,addToList:()=>$D,addWheelListener:()=>Wl,addWithFunction:()=>GD,addXYPlotType:()=>Fa,ajax:()=>ta,anchorPlacementEquals:()=>uE,apply:()=>Jv,applyConnectionType:()=>wS,applyDomainOverrides:()=>iD,applyRotations:()=>Sx,applyRotationsXY:()=>Tx,areVerticesConnected:()=>_x,arraysEqual:()=>NO,astarFromViewport:()=>FS,att:()=>be,attWithValue:()=>si,attachDiagramPalette:()=>rG,attemptCoerce:()=>Dp,base64Encode:()=>E0,base64EncodeSvgElement:()=>f0,bezierLineIntersection:()=>Tn,bindDarkModeListener:()=>uV,boundingBoxIntersection:()=>EI,boxIntersection:()=>mI,buildDomainScales:()=>oD,calculateNestedDepth:()=>Tc,calculatePowerOf10:()=>Vw,calculateSpacingAdjustment:()=>Si,chebyshevDistance:()=>MD,clampAngle:()=>Ja,classList:()=>pV,clear:()=>B1,clone:()=>lt,cloneIcon:()=>XV,cls:()=>Y,colourDistance:()=>qx,computeBezierConnector:()=>Xd,computeBezierLength:()=>IA,computeDomainScales:()=>aO,computeGroupSize:()=>vu,computeRectangleIntersection:()=>Ig,computeStraightConnector:()=>Qd,computeTranslationForRotation:()=>nL,connectorSegmentLength:()=>QA,consume:()=>le,containsPoint:()=>ps,convertToFullOverlaySpec:()=>ii,convertToMultilineText:()=>Iu,createAbstractBezierConnector:()=>Bd,createAndAppendElementNS:()=>Wr,createChartElement:()=>k,createChartTextElement:()=>hs,createColorPickerTag:()=>tC,createComponent:()=>IS,createContrastLabel:()=>gg,createDiagram:()=>nG,createElement:()=>kr,createElementNS:()=>Qs,createFinderFromAnchorPositions:()=>Js,createGateMap:()=>wd,createPaper:()=>LG,createSurface:()=>oG,createXYPlot:()=>hO,data:()=>Ce,debounce:()=>ea,decodeDragGroupSpec:()=>X0,defaultDataGenerator:()=>N0,defaultExportGeometry:()=>AI,defaultIcons:()=>dh,defaultIdFunction:()=>Jg,defaultImportGeometry:()=>SI,destroySVGOverlay:()=>hf,diagonalAdjacentCellsFinder:()=>xm,directRouter:()=>xA,dist:()=>wA,distanceFromCurve:()=>M_,djikstra:()=>gc,each:()=>xN,eachNotEmpty:()=>bx,edgeSortFunctions:()=>MS,editors:()=>Rr,emptyBox:()=>ec,emptyPaintGeometry:()=>L_,encloses:()=>LD,encodedSvgToDataUrl:()=>y0,ensureSVGContentElements:()=>Ql,ensureSVGLabelElements:()=>Xo,euclideanDistance:()=>ID,evaluateExpression:()=>wi,evaluateSingleExpression:()=>$m,expandRectangle:()=>px,exportConnectorGeometry:()=>Ur,exportData:()=>Qg,exportImage:()=>Lp,exportSVG:()=>Hy,exportSvg:()=>xa,extend:()=>ws,extract:()=>G1,extractBounds:()=>BD,extractPoint:()=>Dt,extractSize:()=>Xn,extractValueFromElement:()=>b0,faceOrientations:()=>rE,fastTrim:()=>St,filterEmpty:()=>xx,filterNull:()=>UD,findAdjacentSegment:()=>Zd,findClosestPoint:()=>xc,findParent:()=>Zt,findParents:()=>lV,findSegment:()=>Wd,fixPrecision:()=>Ec,flatten:()=>O_,floydWarshall:()=>lx,formatValue:()=>jy,freeMovementAdjacencies:()=>qO,generateConstrainFunctionFromContainmentType:()=>mP,generateInspectorTemplate:()=>D0,getAbsolutePosition:()=>PV,getAllEdges:()=>IO,getAllSourceEdges:()=>YD,getAllTargetEdges:()=>XD,getAncestors:()=>gn,getClass:()=>sT,getClosestMidpoint:()=>yx,getConnectedVertices:()=>kD,getConnectorElement:()=>iL,getContrastColor:()=>Yc,getDescendantEdges:()=>Kg,getDescendants:()=>fs,getDownstreamVertices:()=>jD,getEdges:()=>tl,getElementSize:()=>et,getElementType:()=>Gu,getEventSource:()=>zo,getFromSetWithFunction:()=>Bg,getOutlineColor:()=>EN,getPageLocation:()=>UR,getPosition:()=>sn,getPositionOnElement:()=>$u,getRectangleMidpoints:()=>wO,getSelector:()=>aT,getSourceEdges:()=>vx,getSvgPositionRelativeToSvgRoot:()=>Uu,getSvgTranslatePosition:()=>eh,getTargetEdges:()=>Cx,getTouch:()=>ef,getUpstreamVertices:()=>HD,getsert:()=>ms,gradient:()=>Dr,gradientAtPoint:()=>Ud,gradientAtPointAlongPathFrom:()=>pI,gridBackgroundOptions:()=>zC,hasClass:()=>nn,inferAxis:()=>Ts,inferAxisAndDirectionFromOrientation:()=>bm,inferAxisFromSourceAndTargetLocation:()=>tb,inferDirection:()=>eb,initializeBezierConnectorEditors:()=>aP,initializeOrthogonalConnectorEditors:()=>eP,initializeStraightConnectorEditors:()=>nP,insertRTreeChild:()=>vo,insertSorted:()=>Fg,intersectionOfProjectedLines:()=>gx,isAncestor:()=>Ke,isArrayLike:()=>hV,isArrayOrNodeList:()=>oT,isAssignableFrom:()=>Ex,isBarPlot:()=>B$,isBoolean:()=>lo,isCategoryAxis:()=>JP,isConnection:()=>Ks,isConnector:()=>OI,isCustomOverlay:()=>rn,isDOMElement:()=>Yi,isDate:()=>DO,isDescendantGroup:()=>Ox,isEdge:()=>tt,isEdgeNodeEntry:()=>dt,isEdgeSupported:()=>DE,isElement:()=>lT,isEmpty:()=>Qa,isFilterableDataset:()=>tA,isFullOverlaySpec:()=>TS,isFunction:()=>un,isGroup:()=>z,isHTMLLabelOverlay:()=>xT,isLabelOverlay:()=>Xr,isLoopPresent:()=>dA,isMouseDevice:()=>oi,isNamedFunction:()=>FD,isNestedGroup:()=>Zg,isNode:()=>K,isNodeInsideAGroup:()=>Wg,isNodeList:()=>wn,isNodeVertex:()=>Px,isNumber:()=>yc,isObject:()=>ir,isPoint:()=>DA,isPort:()=>H,isSVGElement:()=>Rt,isStackedPlot:()=>Ua,isString:()=>X,isTextNode:()=>cV,isTouchDevice:()=>Rn,isValueAxis:()=>cn,isVertex:()=>bi,lightweightPrintfFormatter:()=>EA,lineCalculators:()=>Ll,lineIntersection:()=>Mg,lineIntersectsOrIsEnclosedByRectangle:()=>ux,lineLength:()=>$e,lineRectangleIntersection:()=>nr,linesIntersection:()=>_O,linesOverlap:()=>Vg,locationAlongCurveFrom:()=>VA,log:()=>U,logEnabled:()=>LO,makeLightweightAnchorFromArraySpec:()=>mu,makeLightweightAnchorFromSpec:()=>bt,manhattanDistance:()=>fc,manhattanLineLength:()=>RD,matchesSelector:()=>Gt,merge:()=>pn,mergeDomainExtents:()=>nD,mergeWithParents:()=>du,minBy:()=>TA,namedContinuousValues:()=>PS,nearestPointOnCurve:()=>NA,newInstance:()=>an,newRecadoInstance:()=>fr,newTemplates2Renderer:()=>yh,normal:()=>dx,objectsEqual:()=>el,octileDistance:()=>VD,offsetRelativeToRoot:()=>zi,orthogonalAdjacencies:()=>QO,orthogonalAdjacentCellsFinder:()=>Qx,orthogonalRouter:()=>yA,pageLocation:()=>ge,paintSVGLabelOverlay:()=>ST,paintSimpleShapeOverlay:()=>AT,paintSvgConnector:()=>JT,parallelLineFromPoint:()=>ND,parallelLineTo:()=>hx,parallelLinesTo:()=>mx,parentAxis:()=>Nr,parentDirection:()=>rb,parse:()=>Nx,parseAttributes:()=>Vm,parseAtts:()=>uA,parseExpression:()=>x_,partition:()=>qa,peek:()=>cA,perpendicularBisectingLine:()=>wD,perpendicularLineTo:()=>Qt,perpendicularToPathAt:()=>gI,pointAlongCurveFrom:()=>MA,pointAlongPath:()=>Fd,pointOnCurve:()=>Ys,pointOnLine:()=>zt,pointsEqual:()=>Ax,populate:()=>ho,populateRegions:()=>Nd,prefersDarkMode:()=>dV,processExpression:()=>Tl,quadrant:()=>us,ready:()=>YG,recordGetsert:()=>Es,rectanglesIntersect:()=>Je,registerDecorator:()=>iG,registerEdgeTypePickerTag:()=>rC,registerExporter:()=>KD,registerParser:()=>Dx,registerPlugin:()=>ke,relocateContinuousAnchor:()=>vv,relocateDynamicAnchor:()=>Cv,relocateWithPositionFinder:()=>Pv,remove:()=>Gg,removeClass:()=>F,removeConnectionClass:()=>Pr,removeRTreeChild:()=>eE,removeWheelListener:()=>Zl,removeWithFunction:()=>wt,renderIcon:()=>qu,renderNamedIcon:()=>Qu,renderPaper:()=>Q0,renderSurface:()=>q0,replace:()=>zg,resolveIfExecution:()=>jm,resolveNode:()=>jn,resolveNodeId:()=>kg,rotatePoint:()=>He,routerLineIntersects:()=>fA,routerLineSgn:()=>Jm,segmentLineAngle:()=>qA,segmentedConnectorSegmentLength:()=>js,setAbsolutePosition:()=>Jt,setElementHeight:()=>OT,setElementRotation:()=>Xi,setElementSize:()=>_r,setElementWidth:()=>PT,setForceMouseEvents:()=>FR,setForceTouchEvents:()=>BR,setOverlayLocation:()=>PE,setPosition:()=>we,setRotatedSvgElementPosition:()=>_T,setSvgTranslatePosition:()=>on,setTranslatedPosition:()=>Ft,setTranslatedX:()=>x$,setTranslatedY:()=>Qh,setXPosition:()=>vT,setYPosition:()=>CT,shortUuid:()=>Ka,snapToGrid:()=>ae,snapToGridUpperBound:()=>DD,sortAndPlaceEdges:()=>Dd,sourceElementSelector:()=>dp,sourceVertexAvoidance:()=>WA,splitIntoSiblings:()=>Qm,stubCalculators:()=>Rl,stubRelocator:()=>rS,subtract:()=>cx,suggest:()=>$g,supportsPathEditing:()=>mT,svgElementToDataUrl:()=>Zv,targetElementSelector:()=>OL,targetVertexAvoidance:()=>ZA,testIntersectingDropTarget:()=>pp,theta:()=>Za,toggleClass:()=>af,touchCount:()=>eT,touches:()=>Fo,transformAnchorPlacement:()=>zs,transformBezierGeometry:()=>jd,transformSegmentedGeometry:()=>eu,translateRect:()=>Ug,updateBezierConnector:()=>Yd,updateClasses:()=>$t,updateEditedOrthogonalConnector:()=>eS,updateStraightConnector:()=>qd,uuid:()=>G,valueInRange:()=>Pl,vertexAvoidance:()=>JA,wrap:()=>id,xml:()=>iT});module.exports=PD(k$);function gc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},g=i.strict!==!1,m=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let _=p[C.getFullId()];return u[_.v.id]},x=(C,_)=>{let w,$;if(C.objectType===he.objectType){for(s[C.getFullId()]=_,w=y(C),$=0;$<w.length;$++)w[$].p!=C&&(s[w[$].p.getFullId()]=_+C.getParent().getInternalEdge(C,w[$].p).cost);g||(s[C.getParent().id]=_)}else for(s[C.id]=_,w=u[C.id],$=0;$<w.length;$++)s[w[$].p.getFullId()]=_},f=C=>n&&!n(C)?1/0:s[m(C)],b=(C,_,w)=>{if(C.objectType===he.objectType){let $=y(C);for(let N=0;N<$.length;N++)a[$[N].p.getFullId()]=w.node;g||(a[C.getParent().id]=w.node)}a[_]=w.node},A=(C,_,w)=>{if(C.objectType===he.objectType){let $=y(C);for(let N=0;N<$.length;N++)l[$[N].p.getFullId()]=w;g||(l[C.getParent().id]=w)}l[_]=w},T=(C,_,w,$,N)=>{let M=-1,D=null,V=1/0;for(let J=0;J<C.length;J++)if(!_[J]){let ye=N(C[J]);ye<V?(V=ye,M=J,D=C[J]):ye===V&&C[J].objectType===he.objectType&&C[J].getParent()===D&&(M=J,D=C[J])}return{node:D,index:M}},S=(C,_)=>{let w=_.getFullId(),$=C[w];return $==null&&(w=_.getParent?_.getParent().id:_.id,$=C[w]),$==null?null:{p:$,id:w}},R=(C,_,w,$,N,M)=>{let D=[],V=$,J=S(_,V);for(;J!=null;)D.splice(0,0,{vertex:V,cost:C[J.id],edge:w[J.id]}),V=J.p,J=S(_,V);return D.splice(0,0,{vertex:V,cost:0,edge:null}),D},v=C=>{for(let _=0;_<C.length;_++){let w=C[_],$=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<$.length;M++)E.push($[M]),p[$[M].getFullId()]=N,u[w.id].push({p:$[M],i:E.length-1}),x($[M],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let O=new Array(r.nodes.length),P=0,I=(C,_,w,$)=>{for(let N=0;N<_.length;N++){let M=_[N];if(w(M)){let D=$(M),V=D.tp||D.tn,J=m(V),ye=f(C.node)+M.getCost(),j=f(V);ye<j&&(x(V,ye),b(V,J,C),A(V,J,M))}}};for(;P<E.length;){let C=T(E,O,s,m,f),_=C.node?m(C.node):null;if(!C.node||f(C.node)==1/0||t&&(_==m(t)||!g&&C.node.objectType===he.objectType&&C.node.isChildOf(t))&&(h.path=R(s,a,l,t,m),h.pathDistance=h.path[h.path.length-1].cost,!d))break;O[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!g&&w.source.objectType===he.objectType&&w.source.isChildOf(C.node),w=>{var $=w.source.objectType===he.objectType?w.source.getParent():w.source,N=w.source.objectType===he.objectType?w.source:null,M=w.target.objectType===he.objectType?w.target.getParent():w.target,D=w.target.objectType===he.objectType?w.target:null;return w.source==C.node||!g&&w.source.objectType===he.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:D}:{tn:$,tp:N}})}return h}function lx(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var mc=class{constructor(r){c(this,"vertices");c(this,"q");this.vertices=[r],this.q=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.q.add(e))}get edges(){return Array.from(this.q)}};var OD=[null,[1,-1],[1,1],[-1,1],[-1,-1]],_D=[null,[-1,-1],[-1,1],[1,1],[1,-1]],fi=2*Math.PI;function yi(i,r){return{x:i.x+r.x,y:i.y+r.y}}function cx(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Dr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function dx(i,r){return-1/Dr(i,r)}function $e(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function RD(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function us(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function Za(i,r){let e=Dr(i,r),t=Math.atan(e),n=us(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function Je(i,r){let e=i.x,t=i.x+i.width,n=i.y,o=i.y+i.height,s=r.x,a=r.x+r.width,l=r.y,h=r.y+r.height;return e<=s&&s<=t&&n<=l&&l<=o||e<=a&&a<=t&&n<=l&&l<=o||e<=s&&s<=t&&n<=h&&h<=o||e<=a&&s<=t&&n<=h&&h<=o||s<=e&&e<=a&&l<=n&&n<=h||s<=t&&t<=a&&l<=n&&n<=h||s<=e&&e<=a&&l<=o&&o<=h||s<=t&&e<=a&&l<=o&&o<=h}function Ig(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function OO(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:Ec(r*i[0].x+e*i[0].y)}}function Ec(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}function Mg(i,r){let e=OO(i),t=OO(r),n=e.A*t.B-t.A*e.B;if(n==0)return null;{let o={x:Math.round((t.B*e.C-e.B*t.C)/n),y:Math.round((e.A*t.C-t.A*e.C)/n)},s=Math.floor(Math.min(i[0].x,i[1].x)),a=Math.round(Math.max(i[0].x,i[1].x)),l=Math.floor(Math.min(i[0].y,i[1].y)),h=Math.round(Math.max(i[0].y,i[1].y)),d=Math.floor(Math.min(r[0].x,r[1].x)),u=Math.round(Math.max(r[0].x,r[1].x)),p=Math.floor(Math.min(r[0].y,r[1].y)),g=Math.round(Math.max(r[0].y,r[1].y));return o.x>=s&&o.x<=a&&o.y>=l&&o.y<=h&&o.x>=d&&o.x<=u&&o.y>=p&&o.y<=g?o:null}}function nr(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=Mg(i,n);o!=null&&e.push(o)}),e}function ux(i,r){return ps(r,i[0],!0)||ps(r,i[1],!0)||nr(i,r).length>0}function LD(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,g,m,E)=>e?p<=g&&m>=E:p<g&&m>E;return u(t,a,n,l)&&u(o,h,s,d)}function ps(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function zt(i,r,e){let t=Dr(i,r),n=us(i,r),o=e>0?OD[n]:_D[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function Qt(i,r,e){let t=Dr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function wD(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Dr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function ae(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function DD(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function _O(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function Vg(i,r,e,t,n=0){let o=_O(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function px(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function gx(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),g=n+u*(o-n);return{x:p,y:g}}function hx(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Dr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function mx(i,r){return[hx(i,r),hx(i,-r)]}function ND(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Dr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var fc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),ID=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),MD=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),VD=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function Ja(i){let r=i%360;return r<0&&(r+=360),r}var LO=!0;function U(...i){if(LO&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function Ex(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function Gg(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function GD(i,r,e){i.findIndex(e)===-1&&i.push(r)}function fx(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function $D(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function $g(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function Bg(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function wt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function He(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function St(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function Fg(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function xi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function Dt(i){return{x:i.x,y:i.y}}function Xn(i){return{width:i.width,height:i.height}}function BD(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function Ug(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Yt=[];for(let i=0;i<256;i++)Yt[i]=(i<16?"0":"")+i.toString(16);function G(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Yt[i&255]+Yt[i>>8&255]+Yt[i>>16&255]+Yt[i>>24&255]+"-"+Yt[r&255]+Yt[r>>8&255]+"-"+Yt[r>>16&15|64]+Yt[r>>24&255]+"-"+Yt[e&63|128]+Yt[e>>8&255]+"-"+Yt[e>>16&255]+Yt[e>>24&255]+Yt[t&255]+Yt[t>>8&255]+Yt[t>>16&255]+Yt[t>>24&255]}function Ka(i=6){return G().substring(0,i-1)}function wO(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function yx(i,r){let e=wO(r).map(t=>({p:t,d:$e(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function Ce(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=Ce(i,d[1]);a[St(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,g=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let m=g(),E=u[3];e==null?s=m[E]:m[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let m=g();o=m[u[3]]||function(){return m[u[3]]={},m[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function qa(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function xx(i){return i.filter(r=>r!=null&&St(r).length>0)}function bx(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function xc(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function ms(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function Es(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function yc(i){return Object.prototype.toString.call(i)==="[object Number]"}function X(i){return typeof i=="string"}function lo(i){return typeof i=="boolean"}function ir(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function DO(i){return Object.prototype.toString.call(i)==="[object Date]"}function un(i){return Object.prototype.toString.call(i)==="[object Function]"}function FD(i){return un(i)&&i.name!=null&&i.name.length>0}function Qa(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function el(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!RO(t,n))return!1}return!0}function UD(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(X(i))return""+i;if(lo(i))return!!i;if(DO(i))return new Date(i.getTime());if(un(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(ir(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function pn(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(X(r[s])||lo(r[s])||un(r[s])||yc(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(ir(r[s])){ir(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function RO(i,r){if(i!=null&&r==null)return!1;if((i==null||X(i)||lo(i)||yc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!NO(i,r))return!1}else return!1;else if(ir(i))if(ir(i)){if(!el(i,r))return!1}else return!1;return!0}function NO(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!RO(i[e],r[e]))return!1;return!0}function Ax(i,r){return i.x===r.x&&i.y===r.y}function Sx(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=He(t,n.c,n.r)}),t}function Tx(i,r){return r.forEach(e=>{i=He(i,e.c,e.r)}),i}function zg(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function ho(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(X(s))return n(s);if(un(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(ir(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var gs=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){Fg(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function kg(i){return H(i)?i.getParent().id:i.getFullId()}function jn(i){return H(i)?i.getParent():i}function K(i){return i!=null&&i.objectType===de.objectType}function Wg(i){return K(i)&&i.group!=null}function z(i){return i!=null&&i.objectType===ie.objectType}function Zg(i){return z(i)&&i.group!=null}function tt(i){return i!=null&&i.objectType===Be.objectType}function H(i){return i!=null&&i.objectType===he.objectType}function Px(i){return i.objectType===de.objectType||i.objectType===ie.objectType}function bi(i){return K(i)||z(i)||H(i)}function Jg(i){return i.id}var zD=".";function tl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function IO(i,r){let e=tl(i,r).slice(0);if(K(i)||z(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,tl(i.ports[t],r));return e}function vx(i){return tl(i,r=>r.source==i)}function Cx(i){return tl(i,r=>r.target==i)}function YD(i){let r=vx(i).slice(0);if(K(i)||z(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,vx(i.ports[e]));return r}function XD(i){let r=Cx(i).slice(0);if(K(i)||z(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Cx(i.ports[e]));return r}function Kg(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?IO(l,h):tl(l,h)).forEach(u=>n.add(u)),!r&&z(l)&&s(l)})};return s(i),Array.from(n)}function Tc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function gn(i){let r=jn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function Ke(i,r){return i==null||r==null?!1:gn(i).indexOf(r)!==-1}function Ox(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(z(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function fs(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),z(n)&&e(n)})};return e(i),r}function jD(i,r){let t=!(K(i)||z(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function HD(i,r){let t=!(K(i)||z(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function kD(i,r){let e=new Set,t=K(i)||z(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function _x(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var rl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"Le",new Map);c(this,"_r",new Map);c(this,"Fe",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"zt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Ro",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.zt=r.defaultIdFunction||Jg,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||zD}Qs(r){delete this.Ro[r.id]}ea(r){this.Ro[r.id]=r}mg(){this.Ro={}}getIdFunction(){return this.zt}setIdFunction(r){this.zt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?G():typeof r=="string"?r:(e||this.getIdFunction())(r)||G()}getTopLevelElements(){return this.Ro}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.Le.get(e[0])||this.Fe.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===he||r.constructor===de||r.constructor===ie)return r;let s=r;if(t=this.zt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.Le.has(s))return this.Le.get(s);if(this.Fe.has(s))return this.Fe.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.Le.get(l)||this.Fe.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.Le.clear(),this._r.clear(),this.Fe.clear(),this.mg()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this._r.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new Be({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this._r.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new de(this,r||{},e||this.zt);return this.Le.has(t.id)?null:(this.nodes.push(t),this.Le.set(t.id,t),this.ea(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.zt)}addGroup(r,e){let t=new ie(this,r,e||this.zt);return this.Fe.has(t.id)?this.Fe.get(t.id):(this.groups.push(t),this.Fe.set(t.id,t),this.ea(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Fe.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.Qs(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.ea(e))}getGroup(r){return typeof r=="string"?this.Fe.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Fe.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=qa(t.group.getMembers(),d=>z(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Fe.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.Qs(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.Le.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.Qs(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this._r.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Be)return r;let e=r;if(r=this.zt(r),typeof r!="string")return e}return this._r.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this._r.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this._r.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return gc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=gc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=gc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,g)=>{let m=u.parents[h][d];if(m.length==0){let E=p.slice();E.unshift(h),g.push(E)}else for(let E=0;E<m.length;E++)if(p.indexOf(m[E][0].id)==-1){let y=p.slice();y.unshift(m[E][0].id),s(h,m[E][0].id,u,y,g)}},a=this.getVertex(r),l=lx({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let g=0;g<u.length;g++){let m=u[g].indexOf(a.id);m>0&&m<u[g].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
|
|
2
|
-
`;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===
|
|
1
|
+
var Ec=Object.defineProperty,$D=Object.defineProperties,F_=Object.getOwnPropertyDescriptor,BD=Object.getOwnPropertyDescriptors,FD=Object.getOwnPropertyNames,B_=Object.getOwnPropertySymbols;var U_=Object.prototype.hasOwnProperty,UD=Object.prototype.propertyIsEnumerable;var gx=(i,r,e)=>r in i?Ec(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,pn=(i,r)=>{for(var e in r||(r={}))U_.call(r,e)&&gx(i,e,r[e]);if(B_)for(var e of B_(r))UD.call(r,e)&&gx(i,e,r[e]);return i},Bm=(i,r)=>$D(i,BD(r));var YD=(i,r)=>{for(var e in r)Ec(i,e,{get:r[e],enumerable:!0})},zD=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of FD(r))!U_.call(i,n)&&n!==e&&Ec(i,n,{get:()=>r[n],enumerable:!(t=F_(r,n))||t.enumerable});return i};var XD=i=>zD(Ec({},"__esModule",{value:!0}),i),Je=(i,r,e,t)=>{for(var n=t>1?void 0:t?F_(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Ec(r,e,n),n};var c=(i,r,e)=>(gx(i,typeof r!="symbol"?r+"":r,e),e);var mB={};YD(mB,{$__proxyEdge:()=>hT,$__unproxyEdge:()=>lT,$_createCircularSvgHandles:()=>zC,$_createRectangularSvgHandles:()=>YC,$_createSvg:()=>Ie,$_setSkeletonPosition:()=>Sy,$addOverlay:()=>Ul,$appendAtIndex:()=>ea,$attr:()=>de,$autoCalculateChartScale:()=>ec,$calculateChartScaleWithStep:()=>tc,$calculateChartScaleWithSteps:()=>c_,$createConnection:()=>aT,$createGradient:()=>ET,$createMarker:()=>dc,$defaultOrthogonalPathCompute:()=>uS,$defaultStraightPathCompute:()=>gR,$doImageExport:()=>ry,$getConnectorPathData:()=>rS,$getMarker:()=>Im,$getOverlay:()=>YE,$getOverlays:()=>IR,$isCompoundAction:()=>AO,$isGroupSizeChangedAction:()=>Lb,$isMoveAction:()=>Rb,$isUpdateAction:()=>Ob,$makeAndAppendCircularHandle:()=>$v,$makeAndAppendRectangularHandle:()=>Bv,$makeCircularHandle:()=>jf,$makeRectangularHandle:()=>Z0,$prepareFontSpec:()=>xi,$rewriteOrthogonalConnector:()=>yS,$spaceLabels:()=>u_,$svgNode:()=>G,$updateLabelOverlayFont:()=>ME,ABSOLUTE:()=>Ke,ACTION_ADD:()=>zS,ACTION_REMOVE:()=>XS,ADD_CLASS_ACTION:()=>GM,ALL_GROUPS_RELAYOUT:()=>YN,ANCHOR_PLACEHOLDER_SELECTOR:()=>Xf,ANIMATION_PHASE_CANCELLED:()=>Ca,ANIMATION_PHASE_FINISHED:()=>Pa,ANIMATION_PHASE_INITIALIZED:()=>WC,ANIMATION_PHASE_TRAVERSING_EDGE:()=>ZC,ANIMATION_PHASE_TRAVERSING_END:()=>Oy,ANIMATION_PHASE_TRAVERSING_START:()=>_y,ANIM_SURFACE_ELEMENT_FLASH:()=>kT,APPEND_TO_CURRENT:()=>ut,AStarGrid:()=>Ps,ATTRIBUTE_CHART_CATEGORY:()=>Xn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>rB,ATTRIBUTE_CHART_SERIES:()=>Et,ATTRIBUTE_CHART_STACK:()=>Pm,ATTRIBUTE_CHART_STACK_TOTAL:()=>_m,ATTRIBUTE_CHART_VALUE:()=>Om,ATTRIBUTE_CLASS:()=>AA,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>HL,ATTRIBUTE_CONTAINER:()=>cf,ATTRIBUTE_CONTEXT:()=>yA,ATTRIBUTE_CONTROLS_ORIENTATION:()=>bL,ATTRIBUTE_DATA_SHAPE_ID:()=>em,ATTRIBUTE_DEFAULT:()=>xA,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>TS,ATTRIBUTE_FILL:()=>ZM,ATTRIBUTE_GROUP:()=>hM,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>Uu,ATTRIBUTE_GROUP_CONTENT:()=>df,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>Fu,ATTRIBUTE_ICON_ID:()=>R0,ATTRIBUTE_ICON_KEY:()=>Sv,ATTRIBUTE_ICON_SIZE:()=>Av,ATTRIBUTE_IS_GROUP:()=>jl,ATTRIBUTE_LOOKUP:()=>Yg,ATTRIBUTE_MANAGED:()=>mt,ATTRIBUTE_NOT_DRAGGABLE:()=>Nl,ATTRIBUTE_ORIENTATION:()=>O0,ATTRIBUTE_ORIGIN:()=>op,ATTRIBUTE_ORIGIN_X:()=>xv,ATTRIBUTE_ORIGIN_Y:()=>bv,ATTRIBUTE_RESET_SELECTION:()=>aC,ATTRIBUTE_STROKE:()=>tV,ATTRIBUTE_STROKE_DASHARRAY:()=>kE,ATTRIBUTE_STROKE_DASHOFFSET:()=>QM,ATTRIBUTE_STROKE_LINECAP:()=>KM,ATTRIBUTE_STROKE_LINEJOIN:()=>JM,ATTRIBUTE_STROKE_MITERLIMIT:()=>qM,ATTRIBUTE_STROKE_OPACITY:()=>eV,ATTRIBUTE_STROKE_WIDTH:()=>rV,ATTRIBUTE_STYLE:()=>SA,ATTRIBUTE_TABINDEX:()=>PE,ATTRIBUTE_TEXT_ANCHOR:()=>nV,ATTRIBUTE_TRANSFORM:()=>ci,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>Pu,ATTRIBUTE_VECTOR_EFFECT:()=>Cu,ATTRIBUTE_VERSION:()=>kM,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>_E,ATTRIBUTE_VJS_EDGE:()=>qe,ATTRIBUTE_VJS_EDGE_TYPE:()=>au,ATTRIBUTE_VJS_ENABLED:()=>gr,ATTRIBUTE_VJS_MAGNET:()=>hu,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>Zv,ATTRIBUTE_VJS_NODE_ID:()=>Qf,ATTRIBUTE_VJS_OVERLAY_ID:()=>cu,ATTRIBUTE_VJS_PORT:()=>rn,ATTRIBUTE_VJS_PORT_ID:()=>Il,ATTRIBUTE_VJS_PORT_TYPE:()=>Xr,ATTRIBUTE_VJS_SCOPE:()=>zo,ATTRIBUTE_VJS_SOURCE:()=>vS,ATTRIBUTE_VJS_SOURCE_PORT:()=>Ws,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>OE,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>Ui,ATTRIBUTE_VJS_TARGET:()=>Mo,ATTRIBUTE_VJS_TARGET_PORT:()=>Vo,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>lu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Yi,ATTRIBUTE_VJS_VERTEX:()=>te,ATTRIBUTE_XMLNS:()=>WM,ATT_DATA_DIR:()=>va,ATT_VJS_RESIZABLE:()=>by,ATT_VJS_ROTATABLE:()=>Ay,ATT_VJS_X_RESIZE:()=>yy,ATT_VJS_Y_RESIZE:()=>xy,AXIS_POSITION_END:()=>bi,AXIS_POSITION_START:()=>ir,AbsoluteBackedLayout:()=>Zn,AbsoluteLayout:()=>mo,AbstractEntry:()=>Gi,AbstractHierarchicalLayout:()=>As,AbstractLayout:()=>fn,AbstractLayoutAdapter:()=>_c,AddGroupMemberAction:()=>cd,AnchorLocations:()=>Pl,ArcSegmentHandler:()=>tu,AreaChart:()=>C_,AreaPlot:()=>uc,ArrayBasedSeries:()=>Ia,ArrowOverlay:()=>_r,AssignLayersStage:()=>Gc,AutoSaver:()=>dl,AvailableBackgrounds:()=>eo,BASIC_SHAPES:()=>Cv,BLOCK:()=>Cr,BOTTOM:()=>ht,BackgroundPlugin:()=>Qo,BalloonLayout:()=>Mc,BarChart:()=>__,BarPlot:()=>Lr,Base:()=>Tc,BaseBrowserUIPlugin:()=>Te,BaseChart:()=>so,BaseDomUiLayoutAdapter:()=>oa,BaseSeriesBasedChartDataSource:()=>ac,BezierEditor:()=>fi,BezierSegmentHandler:()=>tR,BlankDataSource:()=>Na,BlankScale:()=>cc,BrowserUI:()=>aa,BrowserUIClipboard:()=>cp,BrowserUIModel:()=>$y,BrowserUiRecado:()=>Wo,BubbleChart:()=>O_,BubbleChartSeries:()=>cx,CENTER:()=>It,CHART_AXIS_TITLE_ALIGN_END:()=>y_,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>Da,CHART_AXIS_TITLE_ALIGN_START:()=>f_,CHART_TITLE_ALIGN_LEFT:()=>Q$,CHART_TITLE_ALIGN_MIDDLE:()=>q$,CHART_TITLE_ALIGN_RIGHT:()=>eB,CHART_TITLE_PLACEMENT_BOTTOM:()=>sc,CHART_TITLE_PLACEMENT_TOP:()=>lD,CLASS_ANCHOR_CANDIDATE:()=>N1,CLASS_ANCHOR_PLACEHOLDER:()=>pa,CLASS_AREA_CHART:()=>h_,CLASS_AREA_CHART_AREA:()=>xm,CLASS_BACKGROUND:()=>rL,CLASS_BACKGROUND_BORDER:()=>nL,CLASS_BACKGROUND_GRID:()=>qo,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>Pp,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>sL,CLASS_BACKGROUND_GRID_MAJOR:()=>oL,CLASS_BACKGROUND_GRID_MINOR:()=>iL,CLASS_BACKGROUND_TILE:()=>q0,CLASS_BAR_CHART:()=>KP,CLASS_BAR_CHART_BAR:()=>qP,CLASS_BEZIER_GUIDELINE:()=>SP,CLASS_BEZIER_HANDLE:()=>Xh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>Gy,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>bP,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>AP,CLASS_BUBBLE_CHART:()=>QP,CLASS_BUBBLE_CHART_DATA_POINT:()=>e_,CLASS_CHART_AXIS:()=>wa,CLASS_CHART_AXIS_LABELS:()=>Hy,CLASS_CHART_AXIS_LINE:()=>ky,CLASS_CHART_AXIS_TITLE:()=>Wy,CLASS_CHART_BACKGROUND:()=>YP,CLASS_CHART_BODY:()=>Kh,CLASS_CHART_CROSSHAIR:()=>qh,CLASS_CHART_CROSSHAIR_LABEL:()=>Qh,CLASS_CHART_EMPTY:()=>Zy,CLASS_CHART_GRIDLINE:()=>Ky,CLASS_CHART_GRIDLINES:()=>Jy,CLASS_CHART_LEGEND:()=>XP,CLASS_CHART_LEGEND_DOT:()=>HP,CLASS_CHART_LEGEND_ITEM:()=>gm,CLASS_CHART_LEGEND_LABEL:()=>jP,CLASS_CHART_PLOT_BACKGROUND:()=>La,CLASS_CHART_POINT:()=>dn,CLASS_CHART_POINT_HIT_AREA:()=>ym,CLASS_CHART_SCALE_LABEL:()=>a_,CLASS_CHART_SERIES:()=>zP,CLASS_CHART_SUBTITLE:()=>i_,CLASS_CHART_TITLE:()=>n_,CLASS_CHART_X_AXIS:()=>Em,CLASS_CHART_X_AXIS_TITLE:()=>WP,CLASS_CHART_Y_AXIS:()=>fm,CLASS_CHART_Y_AXIS_TITLE:()=>kP,CLASS_COLOR_PICKER:()=>XL,CLASS_COLOR_PICKER_SWATCH:()=>EC,CLASS_COLOR_PICKER_SWATCHES:()=>gC,CLASS_COLUMN_CHART:()=>ZP,CLASS_COLUMN_CHART_COLUMN:()=>JP,CLASS_CONNECTED:()=>Ml,CLASS_CONNECTION_EDIT:()=>zf,CLASS_CONNECTOR:()=>Zs,CLASS_CONNECTOR_OUTLINE:()=>PS,CLASS_CONNECTOR_PATH:()=>CS,CLASS_CONNECTOR_SOURCE_DRAG:()=>Zi,CLASS_CONNECTOR_TARGET_DRAG:()=>Ji,CLASS_CONNECTOR_TRANSIENT:()=>_S,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>sv,CLASS_CONTROLS:()=>Rp,CLASS_CONTROLS_CLEAR:()=>rC,CLASS_CONTROLS_PAN_MODE:()=>Jv,CLASS_CONTROLS_REDO:()=>tC,CLASS_CONTROLS_RESET_SELECTION:()=>iC,CLASS_CONTROLS_SELECT_MODE:()=>ey,CLASS_CONTROLS_UNDO:()=>eC,CLASS_CONTROLS_ZOOM_IN:()=>qv,CLASS_CONTROLS_ZOOM_OUT:()=>Qv,CLASS_CONTROLS_ZOOM_TO_FIT:()=>Kv,CLASS_COPY_PASTE_CONTROLS:()=>Y1,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>s_,CLASS_CROSSHAIR_VALUE_AXIS:()=>o_,CLASS_DEFAULT_GROUP:()=>Rf,CLASS_DEFAULT_NODE:()=>Of,CLASS_DIAGRAM_CELL_TOOL:()=>Iy,CLASS_DIAGRAM_CLONE_CELL:()=>oP,CLASS_DIAGRAM_DELETE_CELL:()=>sP,CLASS_DIAGRAM_GROUP:()=>Ny,CLASS_DIAGRAM_LINK_CELL:()=>sw,CLASS_DIAGRAM_NODE:()=>Dy,CLASS_DRAG_ACTIVE:()=>Er,CLASS_DRAG_HOVER:()=>fr,CLASS_DRAG_HOVER_CANNOT_DROP:()=>lh,CLASS_DRAG_ORIGINAL_GROUP:()=>Lf,CLASS_DUMMY_VERTEX:()=>LS,CLASS_EDGE_CLICK_ENTRY:()=>Nf,CLASS_EDGE_DELETE_BUTTON:()=>Ks,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>uu,CLASS_EDGE_GUIDELINE:()=>Sp,CLASS_EDGE_RELOCATING:()=>Pf,CLASS_EDGE_TYPE_PICKER:()=>WL,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>Yp,CLASS_EDGE_WILL_RELOCATE:()=>Wu,CLASS_ELASTIC_GROUP_RESIZE:()=>lL,CLASS_ELEMENT_DRAGGING:()=>nh,CLASS_EXPORT_CANCEL:()=>Np,CLASS_EXPORT_CONTROLS:()=>nC,CLASS_EXPORT_DIMENSIONS:()=>hC,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>cC,CLASS_EXPORT_OVERLAY:()=>Dp,CLASS_EXPORT_UNDERLAY:()=>wp,CLASS_GAUGE_CHART:()=>OD,CLASS_GAUGE_CHART_LABEL:()=>wD,CLASS_GAUGE_CHART_NEEDLE:()=>DD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>ND,CLASS_GAUGE_CHART_TICK:()=>LD,CLASS_GAUGE_CHART_TRACK:()=>RD,CLASS_GAUGE_CHART_ZONE:()=>R_,CLASS_GROUP:()=>Go,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>Cf,CLASS_GROUP_COLLAPSED:()=>RE,CLASS_GROUP_EXPANDED:()=>LE,CLASS_HOVER:()=>hh,CLASS_INSPECTOR:()=>zL,CLASS_INSPECTOR_ACTIVE:()=>pC,CLASS_INSPECTOR_CLOSE:()=>mC,CLASS_INSPECTOR_INACTIVE:()=>Bp,CLASS_LABEL_OVERLAY:()=>OS,CLASS_LASSO:()=>WT,CLASS_LASSO_MASK:()=>oh,CLASS_LASSO_MASK_BOTTOM:()=>qT,CLASS_LASSO_MASK_LEFT:()=>ZT,CLASS_LASSO_MASK_RIGHT:()=>KT,CLASS_LASSO_MASK_TOP:()=>JT,CLASS_LINE_CHART:()=>l_,CLASS_MINIVIEW:()=>Zu,CLASS_MINIVIEW_CANVAS:()=>QT,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>ov,CLASS_MINIVIEW_COLLAPSE:()=>iv,CLASS_MINIVIEW_COLLAPSED:()=>Ju,CLASS_MINIVIEW_ELEMENT:()=>rv,CLASS_MINIVIEW_GROUP_ELEMENT:()=>nv,CLASS_MINIVIEW_LASSO:()=>tv,CLASS_MINIVIEW_PANNER:()=>ev,CLASS_MINIVIEW_PANNING:()=>_f,CLASS_MINIVIEW_SELECTED_ELEMENT:()=>sh,CLASS_MOST_RECENTLY_DRAGGED:()=>ih,CLASS_NODE:()=>zi,CLASS_ORTHOGONAL_HANDLE:()=>pP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>om,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>gP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>mP,CLASS_OVERLAY:()=>Js,CLASS_OVERLAY_HIDE:()=>Vl,CLASS_PALETTE:()=>Ry,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>Ku,CLASS_PALETTE_DRAG_ACTIVE:()=>av,CLASS_PALETTE_DRAG_HOVER:()=>lv,CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP:()=>hv,CLASS_PALETTE_ELEMENT_CURRENT:()=>cv,CLASS_PALETTE_SELECTED_ELEMENT:()=>ko,CLASS_PALETTE_SET:()=>Qp,CLASS_PALETTE_SET_FILTER:()=>Fh,CLASS_PALETTE_SET_SHAPES:()=>wy,CLASS_PALETTE_SET_TITLE:()=>JC,CLASS_PALETTE_SHAPE:()=>Uh,CLASS_PALETTE_SHAPE_LABEL:()=>Ly,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>ah,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>KC,CLASS_PAN_ZOOM_CANVAS:()=>X0,CLASS_PAN_ZOOM_VIEWPORT:()=>z0,CLASS_PAPER:()=>wT,CLASS_PAPER_CANVAS:()=>DT,CLASS_PAPER_NODE:()=>YV,CLASS_PIE_CHART:()=>ID,CLASS_PIE_SLICE:()=>Mm,CLASS_PIE_SLICE_SELECTED:()=>D_,CLASS_PORT:()=>RS,CLASS_RESIZE_BORDER:()=>is,CLASS_RESIZE_BORDER_BOTTOM:()=>$C,CLASS_RESIZE_BORDER_LEFT:()=>FC,CLASS_RESIZE_BORDER_RIGHT:()=>UC,CLASS_RESIZE_BORDER_TOP:()=>BC,CLASS_RESIZE_FRAME:()=>GC,CLASS_RESIZE_HANDLE:()=>St,CLASS_RESIZE_HANDLE_ACTIVE:()=>hy,CLASS_RESIZE_HANDLE_B:()=>gy,CLASS_RESIZE_HANDLE_BL:()=>dy,CLASS_RESIZE_HANDLE_BR:()=>py,CLASS_RESIZE_HANDLE_L:()=>Ey,CLASS_RESIZE_HANDLE_R:()=>fy,CLASS_RESIZE_HANDLE_T:()=>my,CLASS_RESIZE_HANDLE_TL:()=>cy,CLASS_RESIZE_HANDLE_TR:()=>uy,CLASS_RESIZE_SKELETON:()=>IC,CLASS_RESIZE_SKELETON_BORDERS:()=>MC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>VC,CLASS_ROTATE_HANDLE:()=>Gh,CLASS_ROTATE_LEADER:()=>Wp,CLASS_SANKEY_CHART:()=>GD,CLASS_SANKEY_EDGE:()=>ux,CLASS_SANKEY_LABEL:()=>mx,CLASS_SANKEY_NODE:()=>px,CLASS_SANKEY_SELECTED:()=>lo,CLASS_SANKEY_UNSELECTED:()=>Kr,CLASS_SCATTER_CHART:()=>t_,CLASS_SCATTER_CHART_DATA_POINT:()=>r_,CLASS_SELECTED_MODE:()=>U1,CLASS_SELECT_DEFEAT:()=>gt,CLASS_SHAPE:()=>ph,CLASS_SHAPE_ICON:()=>sp,CLASS_SHAPE_LABEL:()=>Qu,CLASS_SNAPLINE:()=>Hp,CLASS_SNAPLINE_ACTIVE:()=>vC,CLASS_SNAPLINE_ACTIVE_EXACT:()=>CC,CLASS_SNAPLINE_EXACT:()=>sy,CLASS_SNAPLINE_HORIZONTAL:()=>TC,CLASS_SNAPLINE_VERTICAL:()=>SC,CLASS_SOURCE_HOVER:()=>wf,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>My,CLASS_STRAIGHT_DELETE_HANDLE:()=>am,CLASS_STRAIGHT_DRAG_HANDLE:()=>ls,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>fP,CLASS_STRAIGHT_HANDLE:()=>zh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>sm,CLASS_SURFACE:()=>ff,CLASS_SURFACE_CANVAS:()=>xf,CLASS_SURFACE_DIRECT:()=>XT,CLASS_SURFACE_EDGE_DRAGGING:()=>Nn,CLASS_SURFACE_ELEMENT_DRAGGING:()=>vf,CLASS_SURFACE_ELEMENT_FLASH:()=>Sf,CLASS_SURFACE_NO_PAN:()=>yf,CLASS_SURFACE_PAN:()=>bf,CLASS_SURFACE_PANNING:()=>Tf,CLASS_SURFACE_PAN_ACTIVE:()=>Af,CLASS_SURFACE_PAN_BOTTOM:()=>e1,CLASS_SURFACE_PAN_LEFT:()=>KV,CLASS_SURFACE_PAN_RIGHT:()=>QV,CLASS_SURFACE_PAN_TOP:()=>qV,CLASS_SURFACE_POINTER_DEVICE:()=>HT,CLASS_SURFACE_TOUCH_DEVICE:()=>jT,CLASS_TARGET_HOVER:()=>Df,CLASS_TOGGLE_GROUP_COLLAPSE:()=>du,CLASS_TRANSIENT_VERTEX:()=>dv,CLASS_UI_SELECTED_CONNECTION:()=>Gl,CLASS_UI_SELECTED_ELEMENT:()=>Xi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>ly,CLASS_VERTEX_DRAWING_LASSO:()=>PC,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>Kp,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>Py,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Bh,CLASS_VJS_ANIMATE_SOURCE:()=>vy,CLASS_VJS_ANIMATE_TARGET:()=>Cy,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>pG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>mG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Un,CLASS_VJS_TOOLTIP:()=>xD,CLEAR_PATH:()=>DL,CLEAR_VIEW_BOX:()=>wL,COLOR_PICKER_ELEMENT:()=>jL,COMMIT_CURRENT:()=>xO,COMPONENT_TYPE_CONNECTION:()=>XE,CONNECTION:()=>_V,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Oo,CONNECTOR_TYPE_ORTHOGONAL:()=>Hs,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>Kd,CONNECTOR_TYPE_SMOOTH:()=>nS,CONNECTOR_TYPE_STRAIGHT:()=>_n,CONNECT_REASON_API:()=>ol,CONNECT_REASON_COPY_PASTE:()=>Yx,CONNECT_REASON_DATA_LOAD:()=>sl,CONNECT_REASON_TRANSIENT:()=>Ux,CONNECT_REASON_UNDO_REDO:()=>Fx,CONNECT_REASON_USER_ACTIVITY:()=>po,CONTAINMENT_NOT_NEGATIVE:()=>Cw,CONTAINMENT_PARENT:()=>Pw,CONTAINMENT_PARENT_ENCLOSED:()=>_w,CONTENT_TYPES:()=>ba,CSV:()=>WN,CandidateSorter:()=>Hc,CanvasLayoutAdapter:()=>ap,CatchAllEventHandler:()=>rd,CategoryValueChart:()=>jn,CategoryValueTooltip:()=>Fa,CategoryVsAxisPlot:()=>ao,ChartExporter:()=>Tm,ChartLegend:()=>Am,ChartSeries:()=>Sr,CircularLayout:()=>Oc,ClickSplitMode:()=>lm,Clipboard:()=>Yd,Cluster:()=>yc,CollationSeries:()=>Ma,Collicat:()=>hm,ColumnChart:()=>P_,ColumnLayout:()=>ll,CommentEntry:()=>Bs,Components:()=>Le,CompoundAction:()=>yo,Connections:()=>qt,Connectors:()=>Ge,ControlsComponent:()=>Lp,ControlsPlugin:()=>Nh,CopyData:()=>Ud,CopyPasteControlsComponent:()=>oC,CrossingStage:()=>Ts,CsvReader:()=>Ug,CustomOverlayImpl:()=>ef,CustomTag:()=>Dd,DEFAULT:()=>xe,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>Gv,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>fD,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>ED,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>gD,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>mD,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>uD,DEFAULT_ARRAY_SERIES_STEP:()=>dD,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>pD,DEFAULT_AXIS_LINE_SIZE:()=>Ai,DEFAULT_BACKGROUND_COLOR:()=>oD,DEFAULT_BAR_GAP:()=>_D,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>zA,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>JO,DEFAULT_BORDER_HANDLE_SIZE:()=>RC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>b_,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>A_,DEFAULT_CATEGORY_FILL_RATIO:()=>CD,DEFAULT_CHART_EMPTY_MESSAGE:()=>m_,DEFAULT_CHART_ERROR_MESSAGE:()=>g_,DEFAULT_COLOR:()=>vv,DEFAULT_COLOR_PROPERTY:()=>Bf,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>Vv,DEFAULT_CORNER_RADIUS:()=>Rm,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>rP,DEFAULT_DIAGRAM_CELL_WIDTH:()=>tP,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>ow,DEFAULT_DOT_OVERLAY_RADIUS:()=>WR,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Mp,DEFAULT_EDGE_NODE_SIZE:()=>Ag,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>KR,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>qR,DEFAULT_EXPORT_FILENAME:()=>Ip,DEFAULT_FILL_COLOR:()=>yh,DEFAULT_FILL_PROPERTY:()=>$f,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>Rw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>Ow,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>ww,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>Lw,DEFAULT_GRID:()=>eL,DEFAULT_GRID_LINE_COLOR:()=>E_,DEFAULT_HANDLE_OFFSET:()=>DC,DEFAULT_HEIGHT_ATTRIBUTE:()=>eb,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>rb,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>ob,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>nb,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>ib,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>Vc,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>wE,DEFAULT_KEY_ANCHOR:()=>$l,DEFAULT_KEY_ANCHORS:()=>Bl,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>wS,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>DS,DEFAULT_KEY_CONNECTOR:()=>pu,DEFAULT_KEY_CSS_CLASS:()=>NS,DEFAULT_KEY_EDGES_DETACHABLE:()=>cM,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>IS,DEFAULT_KEY_GROUP_SIZE:()=>dM,DEFAULT_KEY_HOVER_CLASS:()=>MS,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>mu,DEFAULT_KEY_MAX_CONNECTIONS:()=>VS,DEFAULT_KEY_NODE_SIZE:()=>uM,DEFAULT_KEY_PAINT_STYLE:()=>$o,DEFAULT_KEY_REATTACH_EDGES:()=>pM,DEFAULT_KEY_SCOPE:()=>DE,DEFAULT_LABEL_COLOR:()=>sD,DEFAULT_LABEL_FILL_RATIO:()=>D0,DEFAULT_LABEL_LOCATION:()=>HR,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>VE,DEFAULT_LABEL_PROPERTY:()=>Ki,DEFAULT_LEFT_ATTRIBUTE:()=>Jx,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>cD,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>hD,DEFAULT_LEGEND_PADDING:()=>tD,DEFAULT_LINE_STROKE:()=>Ph,DEFAULT_MARGIN:()=>aD,DEFAULT_MAXIMUM_BAR_WIDTH:()=>PD,DEFAULT_MINIMUM_HEIGHT:()=>wC,DEFAULT_MINIMUM_WIDTH:()=>LC,DEFAULT_ORTHOGONAL_STUB:()=>iS,DEFAULT_OUTLINE_COLOR:()=>Zo,DEFAULT_OUTLINE_PROPERTY:()=>Eh,DEFAULT_OUTLINE_WIDTH:()=>xh,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>fh,DEFAULT_PALETTE_SELECTOR:()=>QL,DEFAULT_PAPER_MARGIN:()=>NT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>JR,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>ZR,DEFAULT_ROTATE_HANDLE_SIZE:()=>OC,DEFAULT_ROTATE_LEADER_LENGTH:()=>_C,DEFAULT_ROTATION_ATTRIBUTE:()=>qx,DEFAULT_SET_DESCRIPTION:()=>i1,DEFAULT_SET_NAME:()=>n1,DEFAULT_SHAPE_SETS:()=>nP,DEFAULT_SMOOTHING:()=>ER,DEFAULT_SVG_HANDLE_SIZE:()=>kp,DEFAULT_TICK_LINE_STROKE:()=>kv,DEFAULT_TICK_MARKS_PER_CELL:()=>tL,DEFAULT_TITLE_PADDING:()=>sx,DEFAULT_TOP_ATTRIBUTE:()=>Kx,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>Lm,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>wm,DEFAULT_VALUE_AXIS_PADDING:()=>x_,DEFAULT_WIDTH_ATTRIBUTE:()=>Qx,DEFAULT_ZOOM_RANGE:()=>GS,DIAGONAL_AXIS_LR:()=>yn,DIAGONAL_AXIS_RL:()=>Jn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>Oa,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>AC,DataModel:()=>Pc,DataSeriesBasedDataSource:()=>vm,Decorator:()=>mp,Decorators:()=>gp,DefaultRouter:()=>Yl,DefaultSearchTokenizer:()=>_O,Diagram:()=>rm,DiagramCell:()=>Yn,DiagramExportComponent:()=>lP,DiagramLink:()=>Ei,DiagramPalette:()=>Yh,DiagramToolsPlugin:()=>as,DialogConstants:()=>Ae,DiamondOverlay:()=>Du,DotOverlay:()=>Nu,Drag:()=>By,DragGroupsPlugin:()=>ts,DualValueAxisTooltip:()=>Dm,DualValueChart:()=>ja,DualValueChartSeries:()=>Xa,EDGE:()=>vr,EDGE_DRAG_HANDLE:()=>Gn,EDGE_INPUT_METHOD_CLICK:()=>vh,EDGE_INPUT_METHOD_DRAG:()=>In,EDGE_INPUT_STATE_IDLE:()=>Ch,EDGE_INPUT_STATE_LOCKED:()=>Yf,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>Wv,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>F1,EDGE_SNAP_CENTER:()=>w1,EDGE_SNAP_DEFAULT:()=>Lv,EDGE_SNAP_PERIMETER:()=>j0,EDGE_TYPE_PICKER_ELEMENT:()=>ZL,EDGE_UPDATE_REASON_UPDATED:()=>cA,ELEMENT:()=>PV,ELEMENT_CIRCLE:()=>He,ELEMENT_DEFS:()=>oT,ELEMENT_DIV:()=>Ze,ELEMENT_ELLIPSE:()=>sT,ELEMENT_G:()=>q,ELEMENT_INCLUDE_ICON:()=>L0,ELEMENT_INCLUDE_ICONS:()=>w0,ELEMENT_PATH:()=>ee,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>Pe,ELEMENT_TEXT:()=>Qe,ELEMENT_TSPAN:()=>HE,EMPTY_ASTAR_PATH:()=>Cg,EMPTY_BOUNDS:()=>vi,EMPTY_ELEMENT:()=>AR,EPSILON:()=>Hn,EVENT_ADHOC_LAYOUT:()=>Db,EVENT_AFTER_LAYOUT_REFRESH:()=>Is,EVENT_BEFORE_START:()=>OP,EVENT_CANVAS_CLICK:()=>bo,EVENT_CANVAS_DBLCLICK:()=>eA,EVENT_CHANGE:()=>Fp,EVENT_CHART_LOAD:()=>Sm,EVENT_CLICK:()=>Ye,EVENT_CONTEXTMENU:()=>bt,EVENT_CONTEXT_UPDATE:()=>El,EVENT_DATA_APPEND_END:()=>Rg,EVENT_DATA_APPEND_START:()=>Og,EVENT_DATA_LOAD_END:()=>Ir,EVENT_DATA_LOAD_START:()=>fo,EVENT_DATA_UPDATED:()=>Lg,EVENT_DBLCLICK:()=>xo,EVENT_DBLTAP:()=>Br,EVENT_DESELECT:()=>Kt,EVENT_DESTROY:()=>Di,EVENT_DRAG:()=>RP,EVENT_DROP:()=>Sw,EVENT_EDGE_ADDED:()=>hr,EVENT_EDGE_CLICK:()=>Wb,EVENT_EDGE_CONTEXTMENU:()=>qb,EVENT_EDGE_DBLCLICK:()=>Zb,EVENT_EDGE_DBLTAP:()=>Jb,EVENT_EDGE_DRAG:()=>Eb,EVENT_EDGE_DRAG_ABORT:()=>yb,EVENT_EDGE_DRAG_END:()=>fb,EVENT_EDGE_DRAG_START:()=>gb,EVENT_EDGE_GEOMETRY:()=>qn,EVENT_EDGE_MOUSEDOWN:()=>yl,EVENT_EDGE_MOUSEOUT:()=>bd,EVENT_EDGE_MOUSEOVER:()=>Ad,EVENT_EDGE_MOUSEUP:()=>Kb,EVENT_EDGE_PATH_EDITED:()=>Qn,EVENT_EDGE_REDRAW:()=>Sd,EVENT_EDGE_REMOVED:()=>xt,EVENT_EDGE_SOURCE_CHANGED:()=>tn,EVENT_EDGE_TAP:()=>Qb,EVENT_EDGE_TARGET_CHANGED:()=>en,EVENT_EDGE_TYPE_CHANGED:()=>kc,EVENT_EDGE_UPDATED:()=>yt,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>qf,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>Kf,EVENT_END_NODE_TRAVERSAL:()=>kC,EVENT_END_OVERLAY_ANIMATION:()=>to,EVENT_FOCUS:()=>Mb,EVENT_GRAPH_CHANGED:()=>mb,EVENT_GRAPH_CLEARED:()=>Wt,EVENT_GRAPH_CLEAR_START:()=>bn,EVENT_GROUP_ADDED:()=>kt,EVENT_GROUP_COLLAPSE:()=>gd,EVENT_GROUP_EXPAND:()=>Ed,EVENT_GROUP_MEMBER_ADDED:()=>wi,EVENT_GROUP_MEMBER_REMOVED:()=>_s,EVENT_GROUP_MOVE:()=>Kc,EVENT_GROUP_MOVE_END:()=>Vr,EVENT_GROUP_MOVE_START:()=>xb,EVENT_GROUP_RELAYOUT:()=>fl,EVENT_GROUP_REMOVED:()=>Me,EVENT_GROUP_RENDERED:()=>Gr,EVENT_GROUP_TYPE_CHANGED:()=>Jc,EVENT_GROUP_UPDATED:()=>Oe,EVENT_INTERNAL_CONNECTION:()=>wb,EVENT_INTERNAL_EDGE_REDRAW:()=>bb,EVENT_INTERNAL_ELEMENT_REPAINTED:()=>md,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>qc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>Qc,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>ed,EVENT_INTERNAL_VERTEX_UPDATED:()=>Ms,EVENT_KEYUP:()=>Mn,EVENT_LASSO_END:()=>Cd,EVENT_LASSO_START:()=>Td,EVENT_LASSO_UPDATE:()=>vd,EVENT_MOUSEDOWN:()=>pe,EVENT_MOUSEENTER:()=>Gg,EVENT_MOUSEEXIT:()=>$g,EVENT_MOUSELEAVE:()=>Vb,EVENT_MOUSEMOVE:()=>oe,EVENT_MOUSEOUT:()=>ot,EVENT_MOUSEOVER:()=>st,EVENT_MOUSEUP:()=>se,EVENT_NODE_ADDED:()=>Zt,EVENT_NODE_MOVE:()=>nr,EVENT_NODE_MOVE_ABORT:()=>td,EVENT_NODE_MOVE_END:()=>Mt,EVENT_NODE_MOVE_START:()=>Os,EVENT_NODE_REMOVED:()=>Re,EVENT_NODE_RENDERED:()=>$r,EVENT_NODE_TYPE_CHANGED:()=>Wc,EVENT_NODE_UPDATED:()=>Ve,EVENT_NODE_VISIBILITY:()=>yd,EVENT_OBJECT_REPAINTED:()=>Ib,EVENT_OUT:()=>vw,EVENT_OVER:()=>Tw,EVENT_PAN:()=>xl,EVENT_PLUGIN_ADDED:()=>xd,EVENT_PLUGIN_REMOVED:()=>Nb,EVENT_PORT_ADDED:()=>Kn,EVENT_PORT_REMOVED:()=>Mr,EVENT_PORT_TYPE_CHANGED:()=>Zc,EVENT_PORT_UPDATED:()=>lr,EVENT_REDO:()=>Tb,EVENT_RELAYOUT:()=>Sn,EVENT_RENDERER_ADDED:()=>Ab,EVENT_RENDER_END:()=>An,EVENT_RENDER_START:()=>fd,EVENT_SELECT:()=>Jt,EVENT_SELECTION_CLEARED:()=>rr,EVENT_START:()=>_P,EVENT_START_NODE_TRAVERSAL:()=>Ty,EVENT_START_OVERLAY_ANIMATION:()=>$h,EVENT_STATE:()=>Jp,EVENT_STOP:()=>LP,EVENT_SURFACE_MODE_CHANGED:()=>Tn,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>$b,EVENT_TOUCHMOVE:()=>Bb,EVENT_TOUCHSTART:()=>Gb,EVENT_UNDO:()=>Sb,EVENT_UNDOREDO_UPDATE:()=>Rs,EVENT_VERTEX_CLICK:()=>Fb,EVENT_VERTEX_CONTEXTMENU:()=>Hb,EVENT_VERTEX_DBLCLICK:()=>Ub,EVENT_VERTEX_DBLTAP:()=>Yb,EVENT_VERTEX_MOUSEDOWN:()=>UN,EVENT_VERTEX_MOUSEMOVE:()=>jb,EVENT_VERTEX_MOUSEOUT:()=>zb,EVENT_VERTEX_MOUSEOVER:()=>Xb,EVENT_VERTEX_MOUSEUP:()=>FN,EVENT_VERTEX_TAP:()=>kb,EVENT_ZOOM:()=>ei,EachEntry:()=>wd,Edge:()=>Ue,EdgeGeometryTransformer:()=>hp,EdgeHandlerBase:()=>ua,EdgeInputHandler:()=>bp,EdgePathEditor:()=>ma,EdgeRelocateHandler:()=>Ap,EdgeRoutingPlugin:()=>Rh,EdgeRoutingStage:()=>$c,EdgeTypePicker:()=>zp,EditorBase:()=>Qi,ElasticGroupManager:()=>ya,ElementCluster:()=>xg,ElementDragHandler2:()=>nm,ElementDragger:()=>NP,ElementEntry:()=>Fr,ElementTypes:()=>Fi,Elements:()=>ni,EllipseOverlay:()=>Mu,EmptyLayout:()=>bs,EmptyRedrawResult:()=>yu,EventGenerator:()=>ag,EventManager:()=>fe,ExportControlsPlugin:()=>jp,FACE_BOTTOM:()=>Ot,FACE_LEFT:()=>Pt,FACE_RIGHT:()=>_t,FACE_TOP:()=>Ct,FALSE:()=>ct,FILL:()=>nT,FIXED:()=>CE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>Iw,FLOWCHART_EDGE_TYPE_DASHED:()=>Vw,FLOWCHART_EDGE_TYPE_PLAIN:()=>Mw,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>Dw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>Nw,FLOWCHART_SHAPES:()=>f1,FixedLayer:()=>pp,FlowchartBasicEdgeMappings:()=>l$,ForceDirectedLayout:()=>wc,GRID_TYPE_DOTTED:()=>V1,GRID_TYPE_LINES:()=>G1,GROUP_RELAYOUT_ADHOC:()=>tA,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>nA,GROUP_RELAYOUT_MEMBER_REMOVED:()=>zN,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>rA,GaugeChart:()=>L_,GeneratedGridBackground:()=>Ea,Graph:()=>il,GridLayout:()=>go,GridProfile:()=>zl,GridTypes:()=>Q0,Group:()=>ie,GroupCollapseAction:()=>ud,GroupExpandAction:()=>pd,GroupLayoutAdapter:()=>lp,GroupRemoveAction:()=>od,GroupSizeChangedAction:()=>ml,H:()=>jx,HEIGHT:()=>Ne,HIERARCHICAL_JSON_DATATYPE:()=>og,HTMLElementOverlay:()=>eh,HeadlessRecado:()=>rE,HierarchicalLayout:()=>Ic,HierarchicalParentRelativePlacementStrategy:()=>Nc,HierarchyLayout:()=>Eo,HierarchyLayoutModel:()=>Bc,HierarchyLayoutStage:()=>Ss,HilbertCurves:()=>Fs,ICONS_ORIENTATION_HORIZONTAL:()=>Tv,ICONS_ORIENTATION_VERTICAL:()=>m1,ICON_CIRCLE:()=>Ev,ICON_CLONE:()=>tp,ICON_CROSS:()=>mv,ICON_GEAR:()=>fv,ICON_LINK:()=>ep,ICON_ORIGIN_CENTER:()=>dh,ICON_ORIGIN_END:()=>uh,ICON_ORIGIN_START:()=>ch,ICON_PLUS:()=>gv,ICON_TRASH:()=>rp,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>JL,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Dh,IconElement:()=>Vf,IfEntry:()=>Id,ImageExportUI:()=>wh,InBrowserTemplateResolver:()=>Mf,Index:()=>fA,Inspector:()=>Up,JSON_DATATYPE:()=>Ht,LASSO_PATH:()=>vL,LASSO_VIEW_BOX:()=>TL,LAYOUT_TYPE_ABSOLUTE:()=>nO,LAYOUT_TYPE_COLUMN:()=>mg,LAYOUT_TYPE_GRID:()=>pg,LAYOUT_TYPE_HIERARCHICAL:()=>cO,LAYOUT_TYPE_HIERARCHY:()=>ab,LAYOUT_TYPE_ROW:()=>gg,LEFT:()=>je,LEGEND_ALIGN_CENTER:()=>nx,LEGEND_ALIGN_LEFT:()=>rx,LEGEND_ALIGN_RIGHT:()=>p_,LEGEND_ORIENTATION_HORIZONTAL:()=>tx,LEGEND_ORIENTATION_VERTICAL:()=>Y$,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>ix,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>oc,LEGEND_VERTICAL_ALIGN_TOP:()=>ic,LINE_WIDTH:()=>HM,LOCATION_ATTRIBUTE:()=>NR,LabelOverlay:()=>mr,Lasso:()=>ga,LassoPlugin:()=>$n,Layouts:()=>nt,LineChart:()=>w_,LinePlot:()=>pc,ListManagerPlugin:()=>Mh,MagnetizeProfile:()=>Ou,Magnetizer:()=>Oi,MiniviewPlugin:()=>Bn,ModelSeriesBasedDataSource:()=>lc,MoveAction:()=>Ds,NEGATIVE:()=>Wx,NOMINAL_SIZE:()=>zr,NONE:()=>pt,Node:()=>le,NodeGroupAction:()=>id,OBJECT_TYPE_ANCHOR:()=>lE,OPPOSITE_FACES:()=>TI,ORIENTATION_OPPOSITE:()=>yE,ORIENTATION_ORTHOGONAL:()=>fE,ORIENTATION_PERPENDICULAR:()=>EE,ORTHOGONAL_AXIS_HORIZONTAL:()=>re,ORTHOGONAL_AXIS_VERTICAL:()=>ue,ORTHOGONAL_FACES:()=>SI,ORTHOGONAL_ROUTER_MODE_BUS:()=>xI,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>Bd,OVERLAY_TYPE_CUSTOM:()=>QE,OVERLAY_VISIBILITY_ALWAYS:()=>gu,OVERLAY_VISIBILITY_HOVER:()=>ji,OptimisticEventGenerator:()=>Gt,OrthogonalEditor:()=>no,Overlay:()=>si,OverlayFactory:()=>at,PALETTE_MODE_DRAG:()=>ny,PALETTE_MODE_DRAW:()=>iy,PALETTE_MODE_TAP:()=>bC,PAN_PATH:()=>OL,PAN_VIEW_BOX:()=>_L,PAPER_ALIGN_CENTER:()=>jo,PAPER_ALIGN_END:()=>Ql,PAPER_ALIGN_START:()=>ql,PATH_CONSTRAIN_DIAGONAL:()=>Lc,PATH_CONSTRAIN_MANHATTAN:()=>Hx,PATH_CONSTRAIN_METRO:()=>kx,PATH_CONSTRAIN_NONE:()=>qr,PATH_CONSTRAIN_ORTHOGONAL:()=>Qr,PLACEHOLDER_KEY:()=>vl,PLACEHOLDER_VALUE:()=>So,POSITION_RELATIVE:()=>SS,PROPERTY_POSITION:()=>uf,PX:()=>On,Palette:()=>Ta,PalettePlugin:()=>Ih,PanButtonsPlugin:()=>ns,PanZoom:()=>da,Paper:()=>Hh,ParentRelativePlacementStrategy:()=>Uc,PathImpl:()=>al,PathTransport:()=>Zp,PathTransportState:()=>HC,PerimeterAnchorShapes:()=>WO,PieChart:()=>N_,PinchListener:()=>up,PlacementStage:()=>Yc,PlainArrowOverlay:()=>wu,Port:()=>ce,PortAction:()=>ad,PortAddAction:()=>ld,PortRemoveAction:()=>hd,PriorityQueue:()=>Es,PropertyMapper:()=>Vu,PropertyTracker:()=>_u,QuadraticBezierEditor:()=>oo,REMOVE_CLASS_ACTION:()=>$M,RESET_SELECTION_PATH:()=>LL,RESET_SELECTION_VIEW_BOX:()=>RL,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>NC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>Vh,RIGHT:()=>ft,ROLLBACK_CURRENT:()=>bO,ROOT_SHAPE_SET:()=>qi,ROTATION:()=>TN,ROW:()=>Ri,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>MA,RTree:()=>Us,RandomColorGenerator:()=>vs,Recado:()=>vo,RecadoTemplateRenderer:()=>dp,RecordBasedSeries:()=>er,RectangleOverlay:()=>Iu,RemoveGroupMemberAction:()=>dd,ResizingToolsPlugin:()=>ss,RowLayout:()=>hl,SEGMENT_TYPE_ARC:()=>Ll,SEGMENT_TYPE_BEZIER:()=>_o,SEGMENT_TYPE_STRAIGHT:()=>Pn,SELECTION_MODE_EDGES_ONLY:()=>_b,SELECTION_MODE_GROUPS_ONLY:()=>Pb,SELECTION_MODE_ISOLATED:()=>nd,SELECTION_MODE_MIXED:()=>vb,SELECTION_MODE_NODES_ONLY:()=>Cb,SELECTOR_CONNECTOR:()=>kr,SELECTOR_GROUP_CONTAINER:()=>fT,SELECTOR_MANAGED_ELEMENT:()=>Hl,SELECTOR_OVERLAY:()=>wn,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>yT,SOURCE:()=>it,STATIC:()=>AS,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>jG,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>yP,STROKE:()=>jE,STROKE_WIDTH:()=>iT,SURFACE_MODE_DISABLED:()=>Ko,SURFACE_MODE_PAN:()=>xr,SURFACE_MODE_SELECT:()=>mi,SURFACE_MODE_VERTEX_DRAWING:()=>Vn,SVGElementOverlay:()=>ju,SVG_NAMESPACE:()=>Vt,SankeyChart:()=>G_,ScatterChart:()=>$_,Segments:()=>dr,SelectedEdgeHighlightPlugin:()=>fa,SeriesBasedChart:()=>Ga,ShapeLibraryDefaults:()=>qu,ShapeLibraryImpl:()=>ia,ShapePalette:()=>tm,ShapeTypeInspector:()=>xC,SimpleBackground:()=>vp,SimpleShapeOverlay:()=>Rn,SingleColorGenerator:()=>Xc,SnaplinesPlugin:()=>rs,SourceValueTargetCsvParser:()=>gA,StaticColorGenerator:()=>lb,Storage:()=>DP,StraightEditor:()=>io,StraightSegmentHandler:()=>Lo,SummingSeries:()=>Va,Surface:()=>jh,SurfaceAnimator:()=>qp,SvgComponent:()=>ku,SvgExportComponent:()=>Sa,SvgExportUI:()=>Gp,SyntheticDecorator:()=>Sh,TAG_SHAPE:()=>pv,TARGET:()=>xn,TILING_STRATEGY_ABSOLUTE:()=>jv,TILING_STRATEGY_LOGARITHMIC:()=>Xv,TOP:()=>Se,TRUE:()=>vt,TWO_PI:()=>Si,TYPE_ATTRIBUTE:()=>TA,TYPE_EACH:()=>ri,TYPE_ELEMENT:()=>ti,TYPE_IF:()=>Tl,TYPE_ITEM_ANCHORS:()=>Au,TYPE_ITEM_CONNECTOR:()=>UE,TYPE_ITEM_OVERLAY:()=>YS,TYPE_JPG:()=>es,TYPE_PNG:()=>Lh,TYPE_ROOT:()=>bA,TYPE_SVG:()=>ty,TYPE_TEXT:()=>Mi,TYPE_TMPL:()=>Ao,TerminusAddAction:()=>pl,TerminusRemoveAction:()=>ul,TestHarness:()=>mm,TextEntry:()=>$i,TiledBackground:()=>Cp,TmplEntry:()=>To,Tooltip:()=>$a,TooltipRenderer:()=>Ba,UICore:()=>Lu,UIModel:()=>fu,UIPlugins:()=>nn,UIState:()=>_p,UNDEFINED:()=>Zx,UiStatesBrowserUIModel:()=>Zf,UiStatesPlugin:()=>Oh,UndoRedoManager:()=>Pd,UpdateAction:()=>Ii,UrlSeriesBasedDataSource:()=>Cm,V:()=>Rc,VERTEX:()=>cl,VERTEX_DRAWING_PATH:()=>PL,VERTEX_DRAWING_VIEW_BOX:()=>CL,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>TO,VERTEX_UPDATE_REASON_ADD_PORT:()=>SO,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>Al,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>dA,VERTEX_UPDATE_REASON_LAYOUT:()=>HN,VERTEX_UPDATE_REASON_MAGNETIZER:()=>uA,VERTEX_UPDATE_REASON_MOVED:()=>$s,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>vO,VERTEX_UPDATE_REASON_RESIZED:()=>mA,VERTEX_UPDATE_REASON_ROTATION:()=>Vs,VERTEX_UPDATE_REASON_SET_POSITION:()=>Rd,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>kN,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>pA,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>hA,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>lA,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>_d,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>Fg,VanillaInspector:()=>Xp,Vertex:()=>vc,VertexDrawingPlugin:()=>gi,VertexSet:()=>zc,Viewport:()=>xu,VisuallyJsModel:()=>Od,VisuallyJsRendererVertexRemovedAction:()=>gl,VisuallyJsSelection:()=>cr,VisuallyJsTestSupport:()=>yi,VjsContext:()=>su,WIDTH:()=>ve,WILDCARD:()=>pr,WhitespaceReplacingTokenizer:()=>KN,X:()=>Q,XHTML_NAMESPACE:()=>oV,XLINK_NAMESPACE:()=>iV,XYChart:()=>Ua,XYPlot:()=>ax,X_AXIS_FACES:()=>bI,Y:()=>Ee,Y_AXIS_FACES:()=>AI,ZOOM_IN_OUT_VIEW_BOX:()=>lC,ZOOM_IN_PATH:()=>NL,ZOOM_OUT_PATH:()=>IL,ZOOM_TO_FIT_PATH:()=>SL,ZOOM_TO_FIT_VIEW_BOX:()=>AL,_addBinding:()=>Xg,_addConnectorSegment:()=>Yr,_adjustForGap:()=>rT,_applyStyles:()=>hf,_areaIfGrownBy:()=>VA,_bindOneAtt:()=>vA,_calculateSteps:()=>qy,_clearConnectorSegments:()=>pE,_computeConnector:()=>XI,_computeSingleLocation:()=>vu,_connectorBoundingBoxIntersection:()=>tS,_connectorBoxIntersection:()=>HI,_connectorGradientAtPoint:()=>zI,_connectorLineIntersection:()=>jI,_connectorPointAlongPathFrom:()=>$e,_connectorPointOnPath:()=>ur,_createAnchor:()=>FE,_createBaseSegment:()=>zs,_createConnectorBase:()=>zd,_createContinuousAnchor:()=>FS,_createCubicBezierConnector:()=>aR,_createQuadraticBezierConnector:()=>lR,_createSegment:()=>BA,_defaultGroupHtmlTemplate:()=>I0,_defaultGroupSvgTemplate:()=>V0,_defaultNodeHtmlTemplate:()=>la,_defaultNodeSvgTemplate:()=>ha,_defaultPortHtmlTemplate:()=>N0,_defaultPortSvgTemplate:()=>M0,_defaultSegmentBoundingBoxIntersection:()=>YA,_defaultSegmentBoxIntersection:()=>_l,_defaultSegmentFindClosestPointOnPath:()=>FA,_defaultSegmentLineIntersection:()=>UA,_emptyRTreeRegion:()=>Co,_findAnchorOrientation:()=>xp,_findConnectorSegmentForLocation:()=>uE,_findConnectorSegmentForPoint:()=>eS,_findIdealSteps:()=>Qw,_findNextHorizontalSegment:()=>oS,_findNextSegmentOfType:()=>qd,_findNextVerticalSegment:()=>aS,_findPreviousHorizontalSegment:()=>sS,_findPreviousVerticalSegment:()=>lS,_findTargetZones:()=>k0,_findZones:()=>W0,_getCurrentAnchorLocation:()=>qS,_getDefaultTemplate:()=>Pv,_getLabelOverlay:()=>wM,_getSegmentLength:()=>cE,_getVertexInfo:()=>fp,_growToFit:()=>iE,_hasLeafNodes:()=>GA,_hideOverlays:()=>MR,_initialiseDecorators:()=>Rv,_internalLabelOverlayClass:()=>jS,_internalLabelOverlayId:()=>Su,_internalSourceMarkerOverlayId:()=>OM,_internalTargetMarkerOverlayId:()=>RM,_isContinuousAnchor:()=>Uo,_isFaceAvailable:()=>Fl,_isLeaf:()=>Fd,_mapToSpline:()=>SE,_padPoint:()=>BM,_placeAnchorsOnLine:()=>KS,_populateSourceZones:()=>Dv,_populateTargetZones:()=>Th,_populateZones:()=>wv,_prepareCompute:()=>gE,_registerSegmentHandler:()=>Ys,_removeOverlay:()=>Fo,_removeShortSegments:()=>fR,_removeTypeCssHelper:()=>WS,_resetConnectorBounds:()=>QA,_resetConnectorGeometry:()=>Bi,_setAnchorLocation:()=>dE,_setOrthogonalSegmentPosition:()=>xS,_showOverlays:()=>VR,_trimOrthogonalConnector:()=>bS,_trimOrthogonalSegments:()=>vE,_trimSegments:()=>TE,_updateConnectorBounds:()=>iR,_updateConnectorSegmentProportions:()=>mE,_updateHoverStyle:()=>Tu,_updateRTreeRegionBounds:()=>oE,_writeSegmentedConnectorSegments:()=>ru,aSegmentDirections:()=>Ro,add:()=>Ti,addClass:()=>L,addConnectionClass:()=>Hr,addEntryToEachExecution:()=>Jg,addNewExecutionToEachExecution:()=>LA,addSegment:()=>Rl,addToDictionary:()=>Ox,addToList:()=>iN,addWheelListener:()=>Jl,addWithFunction:()=>nN,addXYPlotType:()=>Ya,ajax:()=>na,anchorPlacementEquals:()=>xE,apply:()=>uC,applyConnectionType:()=>HS,applyDomainOverrides:()=>SD,applyRotations:()=>Nx,applyRotationsXY:()=>Ix,areVerticesConnected:()=>Bx,arraysEqual:()=>q_,astarFromViewport:()=>tT,att:()=>be,attWithValue:()=>hi,attachDiagramPalette:()=>SG,attemptCoerce:()=>$p,base64Encode:()=>ML,base64EncodeSvgElement:()=>VL,bezierLineIntersection:()=>Cn,bindDarkModeListener:()=>DV,boundingBoxIntersection:()=>VI,boxIntersection:()=>MI,buildDomainScales:()=>TD,calculateNestedDepth:()=>Cc,calculatePowerOf10:()=>eD,calculateSpacingAdjustment:()=>_i,chebyshevDistance:()=>QD,clampAngle:()=>qa,classList:()=>NV,clear:()=>oG,clone:()=>lt,cloneIcon:()=>c1,cls:()=>z,colourDistance:()=>hb,computeBezierConnector:()=>Zd,computeBezierLength:()=>ZA,computeDomainScales:()=>S_,computeGroupSize:()=>Ru,computeRectangleIntersection:()=>Fm,computeStraightConnector:()=>iu,computeTranslationForRotation:()=>S0,connectorSegmentLength:()=>mS,consume:()=>he,containsPoint:()=>gs,convertToFullOverlaySpec:()=>ai,convertToMultilineText:()=>Bu,createAbstractBezierConnector:()=>Xd,createAndAppendElementNS:()=>Zr,createChartElement:()=>k,createChartTextElement:()=>ds,createColorPickerTag:()=>fC,createComponent:()=>ZS,createContrastLabel:()=>bm,createDiagram:()=>TG,createElement:()=>Wr,createElementNS:()=>ta,createFinderFromAnchorPositions:()=>qs,createGateMap:()=>Vd,createPaper:()=>JG,createSurface:()=>CG,createXYPlot:()=>v_,data:()=>Ce,debounce:()=>ra,decodeDragGroupSpec:()=>hw,defaultDataGenerator:()=>qL,defaultExportGeometry:()=>UI,defaultIcons:()=>mh,defaultIdFunction:()=>ng,defaultImportGeometry:()=>YI,destroySVGOverlay:()=>Ef,diagonalAdjacentCellsFinder:()=>Pg,directRouter:()=>IA,dist:()=>HA,distanceFromCurve:()=>eR,djikstra:()=>fc,each:()=>BN,eachNotEmpty:()=>wx,edgeSortFunctions:()=>JS,editors:()=>Rr,emptyBox:()=>nc,emptyPaintGeometry:()=>ZO,encloses:()=>WD,encodedSvgToDataUrl:()=>GL,ensureSVGContentElements:()=>th,ensureSVGLabelElements:()=>Ho,euclideanDistance:()=>qD,evaluateExpression:()=>Vi,evaluateSingleExpression:()=>jg,expandRectangle:()=>Tx,exportConnectorGeometry:()=>Ur,exportData:()=>sg,exportImage:()=>Vp,exportSVG:()=>ex,exportSvg:()=>Aa,extend:()=>Ns,extract:()=>nG,extractBounds:()=>oN,extractPoint:()=>Nt,extractSize:()=>kn,extractValueFromElement:()=>BL,faceOrientations:()=>hE,fastTrim:()=>Tt,filterEmpty:()=>Lx,filterNull:()=>aN,findAdjacentSegment:()=>eu,findClosestPoint:()=>Ac,findParent:()=>Bt,findParents:()=>OV,findSegment:()=>Qd,fixPrecision:()=>Um,flatten:()=>HO,floydWarshall:()=>Ex,formatValue:()=>Qy,freeMovementAdjacencies:()=>fO,generateConstrainFunctionFromContainmentType:()=>wP,generateInspectorTemplate:()=>KL,getAbsolutePosition:()=>HV,getAllEdges:()=>Q_,getAllSourceEdges:()=>hN,getAllTargetEdges:()=>cN,getAncestors:()=>En,getClass:()=>AT,getClosestMidpoint:()=>Rx,getConnectedVertices:()=>pN,getConnectorElement:()=>T0,getContrastColor:()=>jc,getDescendantEdges:()=>ig,getDescendants:()=>xs,getDownstreamVertices:()=>dN,getEdges:()=>nl,getElementSize:()=>et,getElementType:()=>Yu,getEventSource:()=>Xo,getFromSetWithFunction:()=>Hm,getOutlineColor:()=>VN,getPageLocation:()=>s0,getPosition:()=>ln,getPositionOnElement:()=>zu,getRectangleMidpoints:()=>J_,getSelector:()=>ST,getSourceEdges:()=>Mx,getSvgPositionRelativeToSvgRoot:()=>Hu,getSvgTranslatePosition:()=>rh,getTargetEdges:()=>Vx,getTouch:()=>lf,getUpstreamVertices:()=>uN,getsert:()=>fs,gradient:()=>Dr,gradientAtPoint:()=>Hd,gradientAtPointAlongPathFrom:()=>NI,gridBackgroundOptions:()=>iP,hasClass:()=>sn,inferAxis:()=>Cs,inferAxisAndDirectionFromOrientation:()=>_g,inferAxisFromSourceAndTargetLocation:()=>ub,inferDirection:()=>db,initializeBezierConnectorEditors:()=>TP,initializeOrthogonalConnectorEditors:()=>EP,initializeStraightConnectorEditors:()=>xP,insertRTreeChild:()=>Po,insertSorted:()=>km,intersectionOfProjectedLines:()=>vx,isAncestor:()=>Xe,isArrayLike:()=>RV,isArrayOrNodeList:()=>bT,isAssignableFrom:()=>_x,isBarPlot:()=>sB,isBoolean:()=>co,isCategoryAxis:()=>d_,isConnection:()=>Qs,isConnector:()=>kI,isCustomOverlay:()=>on,isDOMElement:()=>Wi,isDate:()=>K_,isDescendantGroup:()=>$x,isEdge:()=>rt,isEdgeNodeEntry:()=>dt,isEdgeSupported:()=>BE,isElement:()=>TT,isEmpty:()=>tl,isFilterableDataset:()=>EA,isFullOverlaySpec:()=>$S,isFunction:()=>mn,isGroup:()=>Y,isHTMLLabelOverlay:()=>IT,isLabelOverlay:()=>jr,isLoopPresent:()=>PA,isMouseDevice:()=>li,isNamedFunction:()=>sN,isNestedGroup:()=>rg,isNode:()=>K,isNodeInsideAGroup:()=>tg,isNodeList:()=>Dn,isNodeVertex:()=>Gx,isNumber:()=>bc,isObject:()=>ar,isPoint:()=>kA,isPort:()=>H,isSVGElement:()=>Rt,isStackedPlot:()=>za,isString:()=>X,isTextNode:()=>LV,isTouchDevice:()=>Ln,isValueAxis:()=>un,isVertex:()=>Ci,lightweightPrintfFormatter:()=>wA,lineCalculators:()=>Dl,lineIntersection:()=>Ym,lineIntersectsOrIsEnclosedByRectangle:()=>Sx,lineLength:()=>Fe,lineRectangleIntersection:()=>sr,linesIntersection:()=>k_,linesOverlap:()=>zm,locationAlongCurveFrom:()=>KA,log:()=>U,logEnabled:()=>Z_,makeLightweightAnchorFromArraySpec:()=>bu,makeLightweightAnchorFromSpec:()=>At,manhattanDistance:()=>xc,manhattanLineLength:()=>kD,matchesSelector:()=>$t,merge:()=>gn,mergeDomainExtents:()=>AD,mergeWithParents:()=>Eu,minBy:()=>$A,namedContinuousValues:()=>US,nearestPointOnCurve:()=>WA,newInstance:()=>hn,newRecadoInstance:()=>yr,newTemplates2Renderer:()=>Ah,normal:()=>Ax,objectsEqual:()=>rl,octileDistance:()=>eN,offsetRelativeToRoot:()=>ki,orthogonalAdjacencies:()=>yO,orthogonalAdjacentCellsFinder:()=>cb,orthogonalRouter:()=>NA,pageLocation:()=>me,paintSVGLabelOverlay:()=>GT,paintSimpleShapeOverlay:()=>VT,paintSvgConnector:()=>uv,parallelLineFromPoint:()=>KD,parallelLineTo:()=>xx,parallelLinesTo:()=>Cx,parentAxis:()=>Nr,parentDirection:()=>pb,parse:()=>Xx,parseAttributes:()=>zg,parseAtts:()=>_A,parseExpression:()=>$O,partition:()=>el,peek:()=>CA,perpendicularBisectingLine:()=>ZD,perpendicularLineTo:()=>wt,perpendicularToPathAt:()=>II,pointAlongCurveFrom:()=>JA,pointAlongPath:()=>jd,pointOnCurve:()=>js,pointOnLine:()=>Xt,pointsEqual:()=>Dx,populate:()=>uo,populateRegions:()=>$d,prefersDarkMode:()=>wV,processExpression:()=>Cl,quadrant:()=>ms,ready:()=>h$,recordGetsert:()=>ys,rectanglesIntersect:()=>tt,registerDecorator:()=>vG,registerEdgeTypePickerTag:()=>yC,registerExporter:()=>fN,registerParser:()=>zx,registerPlugin:()=>We,relocateContinuousAnchor:()=>Fv,relocateDynamicAnchor:()=>Uv,relocateWithPositionFinder:()=>Yv,remove:()=>Xm,removeClass:()=>F,removeConnectionClass:()=>Pr,removeRTreeChild:()=>aE,removeWheelListener:()=>Kl,removeWithFunction:()=>Dt,renderIcon:()=>np,renderNamedIcon:()=>ip,renderPaper:()=>yw,renderSurface:()=>fw,replace:()=>Zm,resolveIfExecution:()=>qg,resolveNode:()=>Wn,resolveNodeId:()=>eg,rotatePoint:()=>De,rotatedRectanglesIntersect:()=>Px,routerLineIntersects:()=>DA,routerLineSgn:()=>nE,segmentLineAngle:()=>pS,segmentedConnectorSegmentLength:()=>ks,setAbsolutePosition:()=>Qt,setElementHeight:()=>YT,setElementRotation:()=>di,setElementSize:()=>Or,setElementWidth:()=>UT,setForceMouseEvents:()=>o0,setForceTouchEvents:()=>i0,setOverlayLocation:()=>NE,setPosition:()=>we,setRotatedSvgElementPosition:()=>zT,setSvgTranslatePosition:()=>an,setTranslatedPosition:()=>Yt,setTranslatedX:()=>F$,setTranslatedY:()=>rc,setXPosition:()=>BT,setYPosition:()=>FT,shortUuid:()=>Qa,snapToGrid:()=>ae,snapToGridUpperBound:()=>JD,sortAndPlaceEdges:()=>Gd,sourceElementSelector:()=>Ep,sourceVertexAvoidance:()=>hS,splitIntoSiblings:()=>sE,stubCalculators:()=>wl,stubRelocator:()=>fS,subtract:()=>bx,suggest:()=>jm,supportsPathEditing:()=>LT,svgElementToDataUrl:()=>dC,targetElementSelector:()=>H0,targetVertexAvoidance:()=>cS,testIntersectingDropTarget:()=>yp,theta:()=>Ka,toggleClass:()=>mf,touchCount:()=>gT,touches:()=>Yo,transformAnchorPlacement:()=>Xs,transformBezierGeometry:()=>Jd,transformSegmentedGeometry:()=>ou,translateRect:()=>Wm,updateBezierConnector:()=>Wd,updateClasses:()=>Ft,updateEditedOrthogonalConnector:()=>gS,updateStraightConnector:()=>nu,uuid:()=>$,valueInRange:()=>Ol,vertexAvoidance:()=>dS,wrap:()=>sd,xml:()=>xT});module.exports=XD(mB);function fc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},m=i.strict!==!1,g=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let O=p[C.getFullId()];return u[O.v.id]},x=(C,O)=>{let w,B;if(C.objectType===ce.objectType){for(s[C.getFullId()]=O,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=O+C.getParent().getInternalEdge(C,w[B].p).cost);m||(s[C.getParent().id]=O)}else for(s[C.id]=O,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=O},f=C=>n&&!n(C)?1/0:s[g(C)],b=(C,O,w)=>{if(C.objectType===ce.objectType){let B=y(C);for(let N=0;N<B.length;N++)a[B[N].p.getFullId()]=w.node;m||(a[C.getParent().id]=w.node)}a[O]=w.node},A=(C,O,w)=>{if(C.objectType===ce.objectType){let B=y(C);for(let N=0;N<B.length;N++)l[B[N].p.getFullId()]=w;m||(l[C.getParent().id]=w)}l[O]=w},T=(C,O,w,B,N)=>{let M=-1,D=null,V=1/0;for(let J=0;J<C.length;J++)if(!O[J]){let ye=N(C[J]);ye<V?(V=ye,M=J,D=C[J]):ye===V&&C[J].objectType===ce.objectType&&C[J].getParent()===D&&(M=J,D=C[J])}return{node:D,index:M}},S=(C,O)=>{let w=O.getFullId(),B=C[w];return B==null&&(w=O.getParent?O.getParent().id:O.id,B=C[w]),B==null?null:{p:B,id:w}},R=(C,O,w,B,N,M)=>{let D=[],V=B,J=S(O,V);for(;J!=null;)D.splice(0,0,{vertex:V,cost:C[J.id],edge:w[J.id]}),V=J.p,J=S(O,V);return D.splice(0,0,{vertex:V,cost:0,edge:null}),D},v=C=>{for(let O=0;O<C.length;O++){let w=C[O],B=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let M=0;M<B.length;M++)E.push(B[M]),p[B[M].getFullId()]=N,u[w.id].push({p:B[M],i:E.length-1}),x(B[M],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let _=new Array(r.nodes.length),P=0,I=(C,O,w,B)=>{for(let N=0;N<O.length;N++){let M=O[N];if(w(M)){let D=B(M),V=D.tp||D.tn,J=g(V),ye=f(C.node)+M.getCost(),j=f(V);ye<j&&(x(V,ye),b(V,J,C),A(V,J,M))}}};for(;P<E.length;){let C=T(E,_,s,g,f),O=C.node?g(C.node):null;if(!C.node||f(C.node)==1/0||t&&(O==g(t)||!m&&C.node.objectType===ce.objectType&&C.node.isChildOf(t))&&(h.path=R(s,a,l,t,g),h.pathDistance=h.path[h.path.length-1].cost,!d))break;_[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!m&&w.source.objectType===ce.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===ce.objectType?w.source.getParent():w.source,N=w.source.objectType===ce.objectType?w.source:null,M=w.target.objectType===ce.objectType?w.target.getParent():w.target,D=w.target.objectType===ce.objectType?w.target:null;return w.source==C.node||!m&&w.source.objectType===ce.objectType&&w.source.isChildOf(C.node)?{tn:M,tp:D}:{tn:B,tp:N}})}return h}function Ex(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var yc=class{constructor(r){c(this,"vertices");c(this,"ee");this.vertices=[r],this.ee=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.ee.add(e))}get edges(){return Array.from(this.ee)}};var jD=[null,[1,-1],[1,1],[-1,1],[-1,-1]],HD=[null,[-1,-1],[-1,1],[1,1],[1,-1]],Si=2*Math.PI;function Ti(i,r){return{x:i.x+r.x,y:i.y+r.y}}function bx(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Dr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function Ax(i,r){return-1/Dr(i,r)}function Fe(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function kD(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function ms(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function Ka(i,r){let e=Dr(i,r),t=Math.atan(e),n=ms(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function tt(i,r){return!(i.x+i.width<r.x||i.x>r.x+r.width||i.y+i.height<r.y||i.y>r.y+r.height)}function Fm(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function Y_(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:r*i[0].x+e*i[0].y}}function Um(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}var Hn=1e-6;function Ym(i,r){let e=Y_(i),t=Y_(r),n=e.A*t.B-t.A*e.B;if(Math.abs(n)<Hn)return null;{let o={x:(t.B*e.C-e.B*t.C)/n,y:(e.A*t.C-t.A*e.C)/n},s=Math.min(i[0].x,i[1].x),a=Math.max(i[0].x,i[1].x),l=Math.min(i[0].y,i[1].y),h=Math.max(i[0].y,i[1].y),d=Math.min(r[0].x,r[1].x),u=Math.max(r[0].x,r[1].x),p=Math.min(r[0].y,r[1].y),m=Math.max(r[0].y,r[1].y);return o.x>=s-Hn&&o.x<=a+Hn&&o.y>=l-Hn&&o.y<=h+Hn&&o.x>=d-Hn&&o.x<=u+Hn&&o.y>=p-Hn&&o.y<=m+Hn?o:null}}function sr(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=Ym(i,n);o!=null&&e.push(o)}),e}function Sx(i,r){return gs(r,i[0],!0)||gs(r,i[1],!0)||sr(i,r).length>0}function WD(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,m,g,E)=>e?p<=m&&g>=E:p<m&&g>E;return u(t,a,n,l)&&u(o,h,s,d)}function gs(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function Xt(i,r,e){let t=Dr(i,r),n=ms(i,r),o=e>0?jD[n]:HD[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function wt(i,r,e){let t=Dr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function ZD(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Dr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function ae(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function JD(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function k_(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function zm(i,r,e,t,n=0){let o=k_(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function Tx(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function vx(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),m=n+u*(o-n);return{x:p,y:m}}function xx(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Dr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function Cx(i,r){return[xx(i,r),xx(i,-r)]}function KD(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Dr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var xc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),qD=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),QD=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),eN=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function qa(i){let r=i%360;return r<0&&(r+=360),r}function z_(i,r){return i.x*r.x+i.y*r.y}function fx(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function X_(i){let r=fx(i);return r===0?{x:0,y:0}:{x:i.x/r,y:i.y/r}}function tN(i,r,e){e=e*Math.PI/180;let t=Math.cos(e),n=Math.sin(e),o=(i.x-r.x)*t-(i.y-r.y)*n+r.x,s=(i.x-r.x)*n+(i.y-r.y)*t+r.y;return{x:o,y:s}}function yx(i){let r=i.x+i.width/2,e=i.y+i.height/2,t={x:r,y:e},n=i.r||0,o=i.width/2,s=i.height/2,a=[{x:r-o,y:e-s},{x:r+o,y:e-s},{x:r+o,y:e+s},{x:r-o,y:e+s}];return n===0?a:a.map(l=>tN(l,t,n))}function j_(i){let r=yx(i),e=[],t={x:r[1].x-r[0].x,y:r[1].y-r[0].y};fx(t)>0&&e.push(X_({x:-t.y,y:t.x}));let n={x:r[3].x-r[0].x,y:r[3].y-r[0].y};return fx(n)>0&&e.push(X_({x:-n.y,y:n.x})),e.length===0&&(e.push({x:1,y:0}),e.push({x:0,y:1})),e}function H_(i,r){let e=z_(i,r[0]),t=e;for(let n=1;n<r.length;n++){let o=z_(i,r[n]);o<e?e=o:o>t&&(t=o)}return{min:e,max:t}}function rN(i,r,e,t){return i<=t&&e<=r}function Px(i,r){if(i.r===0&&r.r===0)return tt(i,r);let e=yx(i),t=yx(r),n=[...j_(i),...j_(r)];for(let o of n){let s=H_(o,e),a=H_(o,t);if(!rN(s.min,s.max,a.min,a.max))return!1}return!0}var Z_=!0;function U(...i){if(Z_&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function _x(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function Xm(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function nN(i,r,e){i.findIndex(e)===-1&&i.push(r)}function Ox(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function iN(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function jm(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function Hm(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function Dt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function De(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function Tt(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function km(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function vi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function Nt(i){return{x:i.x,y:i.y}}function kn(i){return{width:i.width,height:i.height}}function oN(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function Wm(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var jt=[];for(let i=0;i<256;i++)jt[i]=(i<16?"0":"")+i.toString(16);function $(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return jt[i&255]+jt[i>>8&255]+jt[i>>16&255]+jt[i>>24&255]+"-"+jt[r&255]+jt[r>>8&255]+"-"+jt[r>>16&15|64]+jt[r>>24&255]+"-"+jt[e&63|128]+jt[e>>8&255]+"-"+jt[e>>16&255]+jt[e>>24&255]+jt[t&255]+jt[t>>8&255]+jt[t>>16&255]+jt[t>>24&255]}function Qa(i=6){return $().substring(0,i-1)}function J_(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function Rx(i,r){let e=J_(r).map(t=>({p:t,d:Fe(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function Ce(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=Ce(i,d[1]);a[Tt(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,m=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let g=m(),E=u[3];e==null?s=g[E]:g[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let g=m();o=g[u[3]]||function(){return g[u[3]]={},g[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function el(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function Lx(i){return i.filter(r=>r!=null&&Tt(r).length>0)}function wx(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function Ac(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function fs(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function ys(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function bc(i){return Object.prototype.toString.call(i)==="[object Number]"}function X(i){return typeof i=="string"}function co(i){return typeof i=="boolean"}function ar(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function K_(i){return Object.prototype.toString.call(i)==="[object Date]"}function mn(i){return Object.prototype.toString.call(i)==="[object Function]"}function sN(i){return mn(i)&&i.name!=null&&i.name.length>0}function tl(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function rl(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!W_(t,n))return!1}return!0}function aN(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(X(i))return""+i;if(co(i))return!!i;if(K_(i))return new Date(i.getTime());if(mn(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(ar(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function gn(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(X(r[s])||co(r[s])||mn(r[s])||bc(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(ar(r[s])){ar(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function W_(i,r){if(i!=null&&r==null)return!1;if((i==null||X(i)||co(i)||bc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!q_(i,r))return!1}else return!1;else if(ar(i))if(ar(i)){if(!rl(i,r))return!1}else return!1;return!0}function q_(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!W_(i[e],r[e]))return!1;return!0}function Dx(i,r){return i.x===r.x&&i.y===r.y}function Nx(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=De(t,n.c,n.r)}),t}function Ix(i,r){return r.forEach(e=>{i=De(i,e.c,e.r)}),i}function Zm(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function uo(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(X(s))return n(s);if(mn(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(ar(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Es=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){km(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function eg(i){return H(i)?i.getParent().id:i.getFullId()}function Wn(i){return H(i)?i.getParent():i}function K(i){return i!=null&&i.objectType===le.objectType}function tg(i){return K(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===ie.objectType}function rg(i){return Y(i)&&i.group!=null}function rt(i){return i!=null&&i.objectType===Ue.objectType}function H(i){return i!=null&&i.objectType===ce.objectType}function Gx(i){return i.objectType===le.objectType||i.objectType===ie.objectType}function Ci(i){return K(i)||Y(i)||H(i)}function ng(i){return i.id}var lN=".";function nl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function Q_(i,r){let e=nl(i,r).slice(0);if(K(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,nl(i.ports[t],r));return e}function Mx(i){return nl(i,r=>r.source==i)}function Vx(i){return nl(i,r=>r.target==i)}function hN(i){let r=Mx(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Mx(i.ports[e]));return r}function cN(i){let r=Vx(i).slice(0);if(K(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Vx(i.ports[e]));return r}function ig(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?Q_(l,h):nl(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Cc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function En(i){let r=Wn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function Xe(i,r){return i==null||r==null?!1:En(i).indexOf(r)!==-1}function $x(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(Y(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function xs(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function dN(i,r){let t=!(K(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function uN(i,r){let t=!(K(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function pN(i,r){let e=new Set,t=K(i)||Y(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function Bx(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var il=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"we",new Map);c(this,"Nr",new Map);c(this,"Ue",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"Wt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Mo",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.Wt=r.defaultIdFunction||ng,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||lN}la(r){delete this.Mo[r.id]}ha(r){this.Mo[r.id]=r}Mg(){this.Mo={}}getIdFunction(){return this.Wt}setIdFunction(r){this.Wt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?$():typeof r=="string"?r:(e||this.getIdFunction())(r)||$()}getTopLevelElements(){return this.Mo}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.we.get(e[0])||this.Ue.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===ce||r.constructor===le||r.constructor===ie)return r;let s=r;if(t=this.Wt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.we.has(s))return this.we.get(s);if(this.Ue.has(s))return this.Ue.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.we.get(l)||this.Ue.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.we.clear(),this.Nr.clear(),this.Ue.clear(),this.Mg()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this.Nr.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new Ue({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this.Nr.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new le(this,r||{},e||this.Wt);return this.we.has(t.id)?null:(this.nodes.push(t),this.we.set(t.id,t),this.ha(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.Wt)}addGroup(r,e){let t=new ie(this,r,e||this.Wt);return this.Ue.has(t.id)?this.Ue.get(t.id):(this.groups.push(t),this.Ue.set(t.id,t),this.ha(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Ue.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.la(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.ha(e))}getGroup(r){return typeof r=="string"?this.Ue.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Ue.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=el(t.group.getMembers(),d=>Y(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Ue.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.la(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.we.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.la(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this.Nr.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Ue)return r;let e=r;if(r=this.Wt(r),typeof r!="string")return e}return this.Nr.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this.Nr.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this.Nr.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return fc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=fc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=fc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,m)=>{let g=u.parents[h][d];if(g.length==0){let E=p.slice();E.unshift(h),m.push(E)}else for(let E=0;E<g.length;E++)if(p.indexOf(g[E][0].id)==-1){let y=p.slice();y.unshift(g[E][0].id),s(h,g[E][0].id,u,y,m)}},a=this.getVertex(r),l=Ex({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let m=0;m<u.length;m++){let g=u[m].indexOf(a.id);g>0&&g<u[m].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
|
|
2
|
+
`;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===ce.objectType&&t[s].source.getParent()==e){let a={source:t[s].source.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}for(let o=0;o<this.groups.length;o++){n=this.groups[o],r.groups.push(Object.assign({},n.data)),t=n.getEdges();for(let s=0;s<t.length;s++)if(t[s].source===n){let a={source:n.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}return r}getClusters(){return this.vc(this.nodes,this.groups)}getCluster(r){let e=K(r)?[r]:[],t=Y(r)?[r]:[];return this.vc(e,t)[0]}vc(r,e){let t=[],n={},o,s=(a,l)=>{if(a==null||n[a.id])return;l==null?(l=new yc(a),t.push(l)):l.addVertex(a),n[a.id]=!0;let h=a.getAllEdges();for(let d=0;d<h.length;d++){let u=h[d].source===a?h[d].target:h[d].source;s(u,l)}};for(o=0;o<r.length;o++)s(this.nodes[o]);for(o=0;o<e.length;o++)s(this.groups[o]);return t}},Tc=class{constructor(r,e={}){this.graph=r;this.data=e;c(this,"atts",new Map);c(this,"type");this.data=this.data||{},this.type=r.getType(this.data)}setAttribute(r,e){this.atts.set(r,e)}getAttribute(r){return this.atts.get(r)}getType(){return this.type}setType(r){this.type=r}};function Sc(i){return i instanceof ce?i.id:i}var vc=class extends Tc{constructor(e,t,n){super(e,t);this.graph=e;c(this,"id");c(this,"transient");c(this,"transientRenderer");c(this,"dummy");c(this,"edges",[]);c(this,"indegreeCentrality",0);c(this,"outdegreeCentrality",0);c(this,"graphs",[]);this.id=e.getId(t,n),this.data=typeof t=="string"?{id:t}:t}getIndegreeCentrality(){return this.indegreeCentrality}getOutdegreeCentrality(){return this.outdegreeCentrality}addGraph(e){return e=typeof e=="string"?new il({id:e}):e,this.graphs.push(e),e.id||(e.id=""+this.graphs.length),e}getGraph(e){for(let t=0;t<this.graphs.length;t++)if(this.graphs[t].id===e)return this.graphs[t]}getFullId(){return this.id}getEdges(e){if(e==null||e.filter==null)return this.edges;{let t=[];for(let n=0;n<this.edges.length;n++)e.filter(this.edges[n])&&t.push(this.edges[n]);return t}}getSourceEdges(){return this.getEdges({filter:e=>e.source==this})}getTargetEdges(){return this.getEdges({filter:e=>e.target==this})}$addEdge(e){this.edges.push(e),(e.source===this||!e.isDirected())&&this.outdegreeCentrality++,(e.target===this||!e.isDirected())&&this.indegreeCentrality++}$deleteEdge(e){let t=-1;for(let n=0;n<this.edges.length;n++)if(this.edges[n].getId()===e.getId()){t=n;break}return t>-1?(this.edges.splice(t,1),(e.source===this||!e.isDirected())&&this.outdegreeCentrality--,(e.target===this||!e.isDirected())&&this.indegreeCentrality--,!0):!1}inspect(){let e="{ id:"+this.id+`, edges:[
|
|
3
3
|
`;for(let t=0;t<this.edges.length;t++)e+=this.edges[t].inspect()+`
|
|
4
|
-
`;return e+="]}",e}isChildOf(e){return!1}},Yg=class Yg extends Sc{constructor(e,t,n){super(e,t,n);c(this,"objectType",Yg.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new he(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=bc(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=bc(e),o=bc(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=bc(e),a=bc(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(Yg,"objectType","Node");var de=Yg,Xg=class Xg extends Sc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Xg.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(Xg,"objectType","Port");var he=Xg,jg=class jg extends de{constructor(e,t,n){super(e,t,n);c(this,"objectType",jg.objectType);c(this,"members",[]);c(this,"Lo",{})}$addMember(e){return this.Lo[e.id]!=null?!1:(this.members.push(e),this.Lo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Lo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Lo[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(jg,"objectType","Group");var ie=jg,Hg=class Hg extends Ac{constructor(e){super(e.graph,e.data);c(this,"objectType",Hg.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(Hg,"objectType","Edge");var Be=Hg;var Rx="undoRedo",co="userActivity",nl="api",il="dataLoad",Lx="transient",wx="copyPaste";var WD=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let g=l.get(p);g!=null&&g.forEach(m=>{h.push(r.addGroup(m).id)}),l.delete(p),g!=null&&g.forEach(m=>{d(m.id)})};for(let p=0;p<o.length;p++){let g=o[p];if(e.groupDecorator&&e.groupDecorator(g),g.group!=null&&h.indexOf(g.group)===-1)ms(l,g.group,()=>[]).push(g);else{let m=r.addGroup(g);a.set(m.id,g),h.push(m.id),d(m.id)}}l.forEach((p,g)=>{if(h.indexOf(g)===-1)throw new Error("Parent group ["+g+"] not found");p.forEach(m=>h.push(r.addGroup(m).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let g=r.addNode(t[p]);s.set(g.id,t[p])}function u(p){return X(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let g=n[p].data||{},m={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:g};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(g,E,y)}n[p].anchors&&(m.anchors=n[p].anchors),n[p].geometry&&(m.geometry=n[p].geometry),r.$_addEdge(m,il,null)}},ZD=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h.group,t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===he.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l.group,t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===he.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},JD=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},il,null),t(n.children[s])}};t(i)},Xt="json",qg="hierarchical-json",MO={[Xt]:ZD},VO={[Xt]:WD,[qg]:JD};function Dx(i,r){VO[i]=r}function KD(i,r){MO[i]=r}function Nx(i,r,e,t){let n=VO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function Qg(i,r,e){let t=MO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var em=class{constructor(){c(this,"Ue",{});c(this,"ta",!1);c(this,"ra",!1);c(this,"gg",{ready:!0});c(this,"hh",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.ra)this.hh.unshift(arguments);else{if(this.ra=!0,!this.ta&&this.Ue[r]){let o=this.Ue[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.gg[r])this.Ue[r][s](e,t);else try{n=this.Ue[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.Ue==null||this.Ue[r]==null)&&(a=!0)}}this.ra=!1,this.Eg()}return n}Eg(){let r=this.hh.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.Ue={};else if(arguments.length===1){if(typeof r=="string")delete this.Ue[r];else if(r.Wn){let t;for(let n in r.Wn)t=r.Wn[n],Gg(this.Ue[t]||[],r)}}else arguments.length===2&&Gg(this.Ue[r]||[],e);return this}getListener(r){return this.Ue[r]||[]}isSuspendEvents(){return this.ta}setSuspendEvents(r){this.ta=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{fx(this.Ue,o,e,t),e.Wn=e.Wn||{},e.Wn[G()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},Vt=class extends em{shouldFireEvent(r,e,t){return!0}};var ol=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"dh",[]);c(this,"en",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.dh.push(this.result.path[t].vertex),this.en[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==he.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.dh}getVertex(r){return this.en[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.en[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}ze(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.ze((e,t)=>{r(e,t)})}eachVertex(r){this.ze((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.ze((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.ze((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.ze((e,t)=>{z(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var vc=class{constructor(r,e){c(this,"uh",new Map);c(this,"ph",new Map);c(this,"mh",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.uh.set(s,t[s]);let n=e.groups||{};for(let s in n)this.ph.set(s,n[s]);let o=e.ports||{};for(let s in o)this.mh.set(s,o[s])}}getNodeDefinition(r){return this.uh.get(r)||{}}getGroupDefinition(r){return this.ph.get(r)||{}}getPortDefinition(r){return this.mh.get(r)||{}}};var mn=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"Zn");this.Zn=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}Jn(){this.done=!1,this.$vertices.length=0,this.reset()}static fg(){return{padding:{x:0,y:0}}}yg(){let r=Object.assign(i.fg(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return Es(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}xg(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}gh(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.yg();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,g,m)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,g),s=Math.min(s,m),a=Math.max(a,g+E.width),l=Math.max(l,m+E.height),t[p]={x:g,y:m}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(g=>p[g.id]=t[g.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.Jn(),r!=null&&(this.parameters=r),this.gh(e)}layout(r){this.done=!1,this.gh(r)}};var Cc=class{};var GO={},rt={get:(i,r)=>{let e=GO[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{GO[i]=r}};var tm=class tm extends mn{constructor(e){super(e);c(this,"type",tm.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(tm,"type","Empty");var ys=tm;rt.register(ys.type,ys);function qD(i){return{x:i.data.left,y:i.data.top}}var Hn=class extends mn{constructor(e){super(e);c(this,"Eh");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.Eh=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.Eh||qD)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},$O="Absolute",rm=class rm extends Hn{constructor(e){super(e);c(this,"type",rm.type)}getDefaultParameters(){return{}}};c(rm,"type",$O);var uo=rm;rt.register(uo.type,uo);function QD(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var nm=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],im=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],BO=[null,[nm[0],im[1]],[nm[0],im[0]],[nm[1],im[0]],[nm[1],im[1]]],eN=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return QD(r,"x","width",s)?(l=BO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=BO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Si(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Dr(e,t),o=us(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return eN(i,r,n,s,o)}function Ai(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function FO(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var tN={x:20,y:20},rN=1/0;function UO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=ae(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Ti=class{constructor(r){c(this,"we");c(this,"U");c(this,"na");c(this,"ct");c(this,"fh");c(this,"Rr",null);c(this,"rn");c(this,"j");c(this,"nn");c(this,"yh");c(this,"k",[]);c(this,"ne",new Map);c(this,"wo",new Map);c(this,"sn",new Map);c(this,"an",new Set);c(this,"Do",!1);c(this,"xh");c(this,"At",new Map);this.nn=r.positionGetter,this.yh=r.positionSetter,this.j=r.getId,this.rn=r.getSize,this.U=FO(r.elements||[]),this.ct=r.filter||(e=>!0),this.fh=r.exclude||(e=>!1),this.na=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.U.length>0?(this.Kn((e==null?void 0:e.getSize)||this.rn,(e==null?void 0:e.getPosition)||this.nn,e==null?void 0:e.knownLocations),this.ia(r),this.Rr=null,this.oa(e)):{original:{},current:{}}}executeAtCenter(r){if(this.U.length>0){let e=this.Kn((r==null?void 0:r.getSize)||this.rn,(r==null?void 0:r.getPosition)||this.nn,r==null?void 0:r.knownLocations);return this.ia({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Rr=null,this.oa(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.U.length>0?(this.Kn((e==null?void 0:e.getSize)||this.rn,(e==null?void 0:e.getPosition)||this.nn,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Rr={id:r,bounds:this.ne.get(r),element:this.U.find(t=>t.id===r)},this.ia(this.Rr.bounds.center),this.oa(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.Kn(this.rn,this.nn);for(let t=0;t<this.k.length;t++){let n=this.ne.get(this.k[t].id),{moved:o,pos:s}=UO(this.k[t].bounds,r);o&&(e.original[this.k[t].id]=n,e.current[this.k[t].id]=s)}return this.bh(e),e}setElements(r){return this.U=FO(r),this}startTracking(r,e,t){return this.setElements(r),this.Kn(this.rn,this.nn),this.xh=t||rN,this.sn.clear(),this.an.clear(),this.wo.entries().forEach(n=>{this.sn.set(n[0],Object.assign({},n[1]))}),this.Do=e,this}stopTracking(){this.sn.clear(),this.an.clear(),this.Do=!1}addElement(r,e){return r!=null&&(e||this.U.indexOf(r)===-1)&&this.U.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.U,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.U.length;t++)if(this.U[t]===r){e=t;break}return e!==-1&&this.U.splice(e,1),this}reset(){this.U.length=0}ia(r){r!=null&&(this.we=r)}Kn(r,e,t,n){return this.k.length=0,this.ne.clear(),this.wo.clear(),this.At.clear(),this.Ag(this.U,r,e,t,n)}Ag(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),g=this.j(r[d]),m={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.ne.set(g,m),this.wo.set(g,Object.assign({},m)),this.k.push({bounds:m,id:g,element:r[d]}),this.At.set(g,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}Sg(r,e,t,n){if(this.sn.has(r)){let o=this.sn.get(r),s=this.ne.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=$e(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.xh)return null;let p=null,g=0;for(let m=1;m<d;m++){let E={x:a.x+m*h*Math.cos(u),y:a.y+m*h*Math.sin(u)},y=Ai(E,o,{x:0,y:0});UO(y,n);let x=!0;for(let f=0;f<this.k.length;f++){let b=this.k[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=Ai(A.center,A,e);if(Je(y,T)){x=!1;break}}}if(x)g=m,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:g===d-1,positionReached:p}:null}else return null}Tg(r={},e,t,n,o){if((this.Do&&!o||!this.Do&&o)&&this.an.size>0){let a=!1;for(;!a;){let l=!0;this.an.forEach(h=>{let d=this.Sg(h,e,t,n);if(d!=null&&d.moved){let u=this.sn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let g=this.ne.get(h);g.x=p.x,g.y=p.y,g.center.x=p.x+u.width/2,g.center.y=p.y+u.height/2,d.reverted&&this.an.delete(h),l=!1}}),a=l}}}oa(r){let e={};if(this.U.length>1){r=r||{};let n=r.filter||this.ct,o=r.padding||tN,s=r.iterations,a=r.exclude||this.fh;r.gather&&Object.assign(e,this.vg(o,this.na,n,a)),Object.assign(e,this.Cg(o,this.na,n,s,a,r.grid)),this.Tg(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.wo.get(n),t.current[n]=e[n],this.an.add(n);return this.bh(t),t}vg(r,e,t,n){let o={},s=Ai(this.we,{width:0,height:0},r);this.Ah();let a={},l=h=>{let d=[this.we,h],u=[];Array.prototype.push.apply(u,nr(d,s).map(p=>[s,p,null]));for(let p in a){let g=this.ne.get(p);Array.prototype.push.apply(u,nr(d,g).map(m=>[g,m,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.k.length;h++){if(n(this.k[h].id,this.k[h].element))continue;let d=this.k[h].bounds,u=this.k[h].bounds,p=Ai(d.center,u,r);if(t(this.k[h].id,this.k[h].element)){let g=l(d.center);if(g.length>0){g.sort((y,x)=>{let f=$e(y[1],d),b=$e(x[1],d);return f<b?-1:1});let m=g[0][0],E=Si(m,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.k[h].id]=d,a[this.k[h].id]=!0}}}return o}Cg(r,e,t,n,o,s){n=n||2;let a,l;this.Rr!=null?(a=Ai(this.we,this.Rr.bounds,{x:0,y:0}),l=this.Rr.id):a=Ai(this.we,{width:0,height:0},r),this.Ah();let h=1,d=!0,u,p,g={},m=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,g[x]=f},E=(x,f)=>{if(s==null)return f;{let b=yi(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),R=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*R};return cx(v,x)}},y=()=>{let x,f;for(let b=0;b<this.k.length;b++){if(x=this.k[b],o(x.id,x.element))continue;let A=x.bounds,T=Ai(A.center,A,r);x.id!==l&&t(x.id,x.element)&&Je(a,T)&&(u=Si(a,T),u=E(A,u),p=e(x.id,A,u),m(x.id,A,p.x,p.y),T=Ai(A.center,A,r));for(let S=0;S<this.k.length;S++)if(b!==S){if(f=this.k[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let R=f.bounds,v=Ai(R.center,R,r);Je(T,v)&&(d=!0,u=Si(T,v),u=E(R,u),p=e(f.id,R,u),m(f.id,R,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),g}bh(r){for(let e=0;e<this.U.length;e++){let t=this.j(this.U[e]);r.current[t]&&this.yh(this.U[e],r.current[t])}}Ah(){let r={};this.k.sort((e,t)=>{let n=r[e.id]||Math.min($e(e.bounds,this.we),$e(yi(e.bounds,{x:e.bounds.width,y:0}),this.we),$e(yi(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.we),$e(yi(e.bounds,{x:0,y:e.bounds.height}),this.we)),o=r[t.id]||Math.min($e(t.bounds,this.we),$e(yi(t.bounds,{x:t.bounds.width,y:0}),this.we),$e(yi(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.we),$e(yi(t.bounds,{x:0,y:t.bounds.height}),this.we));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var zO={x:30,y:30},om=class om extends mn{constructor(e){super(e);c(this,"Sh");c(this,"type",om.type);c(this,"padding",zO);this.Sh=e.options.centerRoot===!0,this.padding=e.options.padding||zO}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.Sh&&a.length>0){let E=this.getSize(a[0].id,o);p=Math.max(E.width,E.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let g=2*Math.PI/a.length,m=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(m)*p,h+Math.cos(m)*p),m+=g,d>0){let E=a[d-1],y=this.getSize(E.id,o),x=t(E.id),f={x:x.x-s.padding.x,y:x.y-s.padding.y,width:y.width+2*s.padding.x,height:y.height+2*s.padding.y},b=a[d],A=this.getSize(b.id,o),T=t(b.id),S={x:T.x-s.padding.x,y:T.y-s.padding.y,width:A.width+2*s.padding.x,height:A.height+2*s.padding.y},R=Si(f,S),v=[x.x+y.width/2,x.y+y.height/2],O=[T.x+R.x+A.width/2,T.y+R.y+ +(A.height/2)],P=Math.sqrt(Math.pow(v[0]-O[0],2)+Math.pow(v[1]-O[1],2));p=Math.max(p,P/2/Math.sin(g/2))}for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(m)*p,h+Math.cos(m)*p),m+=g;this.done=!0}};c(om,"type","Circular");var Pc=om;rt.register(Pc.type,Pc);var sm="Grid",am="Column",lm="Row";var ve="width",De="height",nN="rotation",Oc="v",Ix="h",Se="top",ze="left",Et="right",ht="bottom",Nt="center",Q="x",Ee="y",En="dlr",kn="drl",Jr="none",Kr="orthogonal",Mx="manhattan",_c="diagonal",Vx="metro",Gx=-1,ue="v",re="h",$x="undefined",xe="default",Tt="true",ct="false",Bx="left",Fx="top",Ux="rotation",zx="width",Yx="height",nt="source",fn="target";var iN={x:30,y:30},vi="row",Xx="column",po=class extends mn{constructor(e){super(e);c(this,"ln",[]);c(this,"sa");c(this,"aa");c(this,"de");c(this,"cn");c(this,"hn");c(this,"Lr");c(this,"wr");c(this,"la");c(this,"type");this.type=sm,this.de=e.options.orientation||vi,this.padding=e.options.padding||iN,this.sa=e.options.verticalAlignment||Nt,this.aa=e.options.horizontalAlignment||Nt,this.cn=e.options.rows||-1,this.hn=e.options.columns||-1,this.la=e.options.sort}getDefaultParameters(){return{orientation:vi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.ln.length=0;let a,l;if(this.la!=null){let p=this.$vertices.slice();p.sort(this.la),this.$vertices=p}if(this.cn===-1&&this.hn===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.de===vi?1:0),l=p+(this.de===Xx?1:0)}else this.cn!==-1?(a=this.cn,l=Math.ceil(this.$vertices.length/a)):this.hn!==-1&&(l=this.hn,a=Math.ceil(this.$vertices.length/l));this.Lr=-1/0,this.wr=-1/0;let h=0,[d,u]=this.de===vi?[a,l]:[l,a];for(let p=0;p<d;p++){this.ln[p]=[];for(let g=0;g<u;g++)if(h=p*u+g,h<this.$vertices.length){let m=this.$vertices[h],E=this.getSize(m.id,o);this.Lr=Math.max(this.Lr,E.width),this.wr=Math.max(this.wr,E.height),this.ln[p][g]={vertex:m,size:E}}}}end(e,t,n,o,s){}reset(){}Og(e){let t=this.de===vi&&this.cn===1||this.aa===ze?0:this.aa===Nt?(this.Lr-e.width)/2:this.Lr-e.width,n=this.de===Xx&&this.hn===1||this.sa===Se?0:this.sa===Nt?(this.wr-e.height)/2:this.wr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.ln.length;h++){for(let d=0;d<this.ln[h].length;d++){let u=this.ln[h][d],{padX:p,padY:g}=this.Og(u.size);n(u.vertex.id,a+p,l+g),this.de===vi?a+=this.padding.x*2+(this.cn===1?u.size.width:this.Lr):l+=this.padding.y*2+(this.hn===1?u.size.height:this.wr)}this.de===vi?(l+=this.padding.y*2+this.wr,a=0):(a+=this.padding.x*2+this.Lr,l=0)}this.done=!0}};c(po,"type",sm),rt.register(po.type,po);var sl=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Xx,columns:1})})),this.type=am}};c(sl,"type",am),rt.register(sl.type,sl);var al=class extends po{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:vi,rows:1})})),this.type=lm}};c(al,"type",lm),rt.register(al.type,al);var YO=1e-11,hm=class hm extends Hn{constructor(e){super(e);c(this,"No");c(this,"type",hm.type);c(this,"U",new Map);c(this,"qn",new Map);c(this,"Qn");c(this,"St");c(this,"Io",1/0);c(this,"Mo",-1/0);c(this,"Vo",1/0);c(this,"Go",-1/0);c(this,"Tt",[]);c(this,"ca",new Map);c(this,"vt");c(this,"ha");this.vt=pn(this.getDefaultParameters(),e.options),this.St=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.Zn}}dn(e,t,n){return t=Ec(t),n=Ec(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{Pg:t,_g:n}}un(e){return this.qn.get(e.id)===!0}Rg(e){this.qn.set(e.id,!0)}reset(){super.reset(),this.U.clear(),this.qn.clear(),this.No=0,this.Io=this.Vo=1/0,this.Mo=this.Go=-1/0,this.ca.clear()}begin(e,t,n,o,s){this.Tt.length=0,this.U.clear(),this.No=0,this.Io=1/0,this.Mo=-1/0,this.Vo=1/0,this.Go=-1/0,this.ha=this.vt.r,this.St&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}ht(e,t,n){let o=H(e)?e.getParent():e,s=this.U.get(o.id);if(!s){let a=t(o.id)||this.xg(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.U.set(o.id,s),this.ca.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}da(e,t,n){return this.Tt[e]?this.Tt[e]:(this.Tt[e]=this.ht(this.$vertices[e],t,n),this.Tt[e])}step(e,t,n,o,s){let a;for(this.Qn=0,a=0;a<this.$vertices.length;a++){let l=this.da(a,t,o);if(this.St&&!this.un(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.Th(l,d.x,d.y),n(l.id,d.x,d.y),this.Rg(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this.da(d,t,o);this.Lg(l,u)}let h=this.ca.get(l.id);for(let d=0;d<h.length;d++)this.wg(l,h[d],t,o)}if(this.Qn!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this.da(a,t,o);if(!this.un(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.Th(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.No++,(this.Qn===0||this.No>=this.vt.iterations)&&(this.Dg(n,o),this.done=!0)}end(e,t,n,o,s){this.qn.clear(),this.U.forEach((a,l)=>{this.qn.set(l,!0)})}Th(e,t,n){let{Pg:o,_g:s}=this.dn(e,t,n);this.Io=Math.min(this.Io,o),this.Vo=Math.min(this.Vo,s),this.Mo=Math.max(this.Mo,o),this.Go=Math.max(this.Go,s)}Dg(e,t){this.U.forEach((n,o)=>{let s=this.U.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}Lg(e,t){let n=this.un(e),o=this.un(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(Je(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=nr(d,e)[0],p=nr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<YO&&(h=1,s=1,a=1)}if(h<this.vt.spacing){this.Qn++;let d=this.ha*(this.vt.spacing-h),u=1,p=1,g=u*d*s/h,m=p*d*a/h,E=o?0:(n?2:1)*g,y=o?0:(n?2:1)*m,x=n?0:(o?2:1)*g,f=n?0:(o?2:1)*m;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}wg(e,t,n,o){let s=this.ht(t.target,n,o),a=this.un(e),l=this.un(s);if(a&&l)return;this.Qn++;let h,d,u,p,g;if(Je(e,s))p=-2*this.vt.spacing,h=-2*this.vt.spacing,d=-2*this.vt.spacing;else{let y=[e.center,s.center],x=nr(y,e)[0],f=nr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<YO&&(p=1,h=1,d=1)}g=this.ha*(p-this.vt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),g*=Math.log(t.cost)*.5+1;let m=g*h/p,E=g*d/p;s.f[0]-=l?0:(a?2:1)*m,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*m,e.f[1]+=a?0:(l?2:1)*E}};c(hm,"type","ForceDirected");var Rc=hm;rt.register(Rc.type,Rc);function oN(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var xs=class extends Hn{constructor(e){super(e);c(this,"Ch");c(this,"pn");c(this,"Oh");this.Ch=!!e.options.ignoreLoops,this.Oh=e.options.ignorePorts===!0,this.pn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(Px(n)){let o=n.getTargetEdges();return(o.length===0||oN(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.Ch,s.getRootNode=this.pn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Oh!==!0&&H(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var jx=Nt,Hx={x:60,y:60},kx="auto",Wx=Nt;function Lc(i){return i.parents.length>0?i.parents[0].loc:null}function cm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function sN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function XO(i){return i.parents.length>0?i.parents[0].childGroup:null}function aN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var wc=class{constructor(r,e){this.dataSource=r;c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"mn",-1/0);c(this,"gn",1/0);c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"positions",new Map);c(this,"ua",{[Nt]:r=>Lc(r)+cm(r,this.J)/2-(r.size-this.J)/2,start:r=>Lc(r),end:r=>Lc(r)+cm(r,0)-(r.size-this.J)});c(this,"j");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"ya",{center:(r,e,t)=>(e+t)/2-cm(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.j=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?"y":"x",this.Ot=this.xe?ve:De,this.ni=this.xe?De:ve,this.ve=e.invert===!0,this.D=e.alignment||Wx,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(g,m)=>this.Yt&&g.parents&&g.parents.length>0?this.positions.get(this.j(g.parents[0].node)).position[this.ri]+this.pa(g,this.ti)+this.Ct:m,p=!1;if(a===0&&this.St===!0){let g=this.ii(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.si(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.j(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.positions}si(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height;this.mn=Math.max(this.mn,o),this.gn=Math.min(this.gn,o)}ht(r){let e=this.P[r];return e||(e={entries:[],pointer:0},this.P[r]=e),e}qe(r,e,t,n,o){let s=this.ht(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+this.J,s.entries.push(a),n&&n.children.push(a),a}ma(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ga(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.ht(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}pa(r,e){let t=r.parents.map(n=>n.dimensions[e===0?ve:De]);return Math.max.apply(null,t)}Ea(r){if(r.size>0){let e=this.ua[this.D](r),t=this.Nr[r.depth],n=this.D==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.fa(r),this.ma(r,r.depth)}}xa(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.ya[this.D](r,e,t),o=n-Lc(r);if(this.ga(r,n),!sN(r)){let s=XO(r),a=aN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}fa(r){let e=r;for(;e!=null;)this.xa(e),e=XO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.ht(e+1),l=this.Xt(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Pt(this.j(h)),u=a.entries.find(p=>this.j(p.node)===this.j(h));if(u!=null){u.parents.push(r);let p=Lc(u),g=cm(u,this.J),m=p+g/2-u.size/2,E=m-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.qe(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let g=d[this.Ot];t.size+=g+this.J,n.push(p)}s[h.id]=!0}}for(this.Ea(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}};var jO="Hierarchical",dm=class dm extends xs{constructor(e){super(e);c(this,"type",dm.type);c(this,"de");c(this,"xe");c(this,"ue");c(this,"Yt");c(this,"ve");c(this,"D");c(this,"Ph");c(this,"P",[]);c(this,"Xt");this.ve=e.options.invert,this.Ph=e.options.spacing||kx,this.Yt=this.Ph==="compress",this.D=e.options.align||jx,this.de=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:Hx,orientation:this.de,locationFunction:this.Zn,align:this.D}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.de=s.orientation,this.xe=this.de==="horizontal",this.ue=this.xe?0:1,this.padding=s.padding,this.P.length=0,this.Xt=s.getChildVertices}step(e,t,n,o,s){new wc(e,{rootNode:s.rootNode,compress:this.Yt,padding:this.padding,axisIndex:this.ue,invert:this.ve,alignment:this.D,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Xt(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.P}getOrientation(){return this.de}};c(dm,"type",jO);var Dc=dm;rt.register(Dc.type,Dc);var um=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"ne",new Map);c(this,"_h",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=G(),this.group=[r]}setPosition(r,e,t){this.ne.set(r,{x:e,y:t})}getPosition(r){return this.ne.get(r)}getIncidentAngle(r){return this._h.get(r)}setIncidentAngle(r,e){this._h.set(r,e)}getPositions(){return this.ne}},lN=100,hN={x:50,y:50},pm=class pm extends xs{constructor(e){super(e);c(this,"type",pm.type);c(this,"Rh");c(this,"Qe",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||lN,this.padding=e.options.padding||hN,this.clusterMagnetizer=new Ti({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.Qe[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.Zn,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.Qe.length=0,this.Rh=s.getChildEdges}Lh(e,t,n,o,s,a,l){let h=(T,S,R,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:R+2*a.padding.x,height:v+2*a.padding.y}),d,u=new um(e),p=s?s.position:{x:0,y:0},g=p.x,m=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.Rh(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,R=H(S)?S.getParent():S;u.children.add(R)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(g-x.width/2,m-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.Qe.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,R=S,v=null;u.children.forEach(N=>{f=y(N.id);let M=h(g+Math.sin(S)*f.width,m+Math.cos(S)*f.height,f.width,f.height),D=Si(b,M),V=Math.sqrt(Math.pow(M.x+D.x-g,2)+Math.pow(M.y+D.y-m,2));if(d=Math.max(d,V),u.setPosition(N.id,M.x+D.x,M.y+D.y),S+=T,v!=null){let J=y(v.id),ye=u.getPosition(v.id),j=h(ye.x,ye.y,J.width,J.height),me=y(N.id),Ge=u.getPosition(N.id),je=h(Ge.x,Ge.y,me.width,me.height),Ut=Si(j,je),rr={x:ye.x+J.width/2,y:ye.y+J.height/2},qt={x:Ge.x+Ut.x+me.width/2,y:Ge.y+Ut.y+ +(me.height/2)},wr=Math.sqrt(Math.pow(rr.x-qt.x,2)+Math.pow(rr.y-qt.y,2));d=Math.max(d,wr/2/Math.sin(T/2))}v=N}),S=R,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,g+Math.sin(S)*d,m+Math.cos(S)*d),S+=T});let O=u.getPosition(e.id),P=O.x,I=y(e.id),C=P+I.width,_=O.y,w=_+I.height,$;u.children.forEach(N=>{if(!this.Lh(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){$=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+$.width),_=Math.min(_,D.y),w=Math.max(w,D.y+$.height)}}),u.extents=[P,C,_,w],u.offsets={};for(let N=0;N<u.group.length;N++){let M=u.group[N],D=u.getPosition(M.id);u.offsets[M.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.Lh(s.rootNode[0],t,n,o,null,s,0),this.Qe.length>0){let a=(this.Qe[0].extents[0]+this.Qe[0].extents[1])/2,l=(this.Qe[0].extents[2]+this.Qe[0].extents[3])/2;this.clusterMagnetizer.setElements(this.Qe),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.Qe.length;a++)this.Qe[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(pm,"type","Balloon");var Nc=pm;rt.register(Nc.type,Nc);var bs=class{constructor(r){this.model=r}};var Tr="edge",ll="vertex",Ic="center",gm=30;function dt(i){return i.type===Tr}var Mc=class extends bs{constructor(e,t){super(e);this.vertexSet=t;c(this,"jt",new Map);c(this,"$o",!1);c(this,"kt");c(this,"Ir",[]);c(this,"Dh",new Set);c(this,"ai");this.ai=e.layout.ai}Ng(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.jt.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}Nh(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.Dh.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.jt.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.Ng(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.jt.has(p.id));if(u.length>0){let p=Math.max(...u.map(g=>this.vertexSet.findLayerIndex(g.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let g={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:Tr,entries:[]};this.vertexSet.edgeNodes.push(g),this.vertexSet.edgeNodeMap.set(p.id,g)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:Tr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Ir.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.jt.set(s[a].id,!0),this.Nh(s[a],t+1)}Ig(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.jt.clear(),this.$o=!1,this.kt=0,this.Ir.length=0,this.jt.set(e.id,!0);!this.$o;)if(this.Nh(e,this.kt),this.Ir.length>0)if(this.Ir=this.Ir.filter(t=>!this.jt.has(t[0].id)),this.Ir.length>0){let t=this.Ir.splice(0,1)[0];e=t[0],this.kt=t[1],this.jt.set(e.id,!0),this.vertexSet.addToLayer(this.kt,e)}else this.$o=!0;else this.$o=!0;this.ai&&this.Mg(),this.Ig()}Mg(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.Dh)}};var Zx=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function cN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var As=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"li");c(this,"ci");t=t||{},this.li=t.maxIterations||24,this.ci=t.maxIterationsWithoutImprovement||5}Vg(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.Vg(),e=r,t=0,n=this.Ih(r),o=Zx(e);for(let s=0;s<this.li;s++){let a=this.Gg(s,e),l=this.Ih(a);if(l.total<n.total)n=l,t=0,o=Zx(a);else if(l.total===n.total){let h=Zx(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.ci)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}Ih(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.$g(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}$g(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,g=this.getAdjacentEntries(e,t,u),m=[];for(let E=0;E<g.length;E++){let y=g[E][1];m.push(y)}m.sort(function(E,y){return E-y}),l[p]=m}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let g=u[1]+1;g<a.length;g++)n.push(...a[g])}return n}Gg(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.Mh(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.Mh(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}Mh(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(m=>!dt(m[0])),g=u.filter(m=>dt(m[0]));g.length>0&&(g.sort((m,E)=>m[0].obj.span>E[0].obj.span?-1:E[0].obj.span>m[0].obj.span?1:0),p.push(g[0])),u.length>0?s.push([d,cN(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===ll&&u[0].type===ll?0:d[0].type===Tr&&u[0].leaf?-1:u[0].type===Tr&&d[0].leaf?1:0),s.map(d=>d[0])}};var HO="xmax",kO="ymax",WO="xmin",ZO="ymin",mm="_min",Em="_max",Vc=class{constructor(r,e,t,n,o){this.R=r;this.se=e;this.axis=t;this.ve=n;this.Bg=o;c(this,"hi",{})}execute(){this.hi={};let r=this.Bg(),e={},t=this.axis===0?{[mm]:WO,[Em]:HO}:{[mm]:ZO,[Em]:kO},n=this.axis===1?{[mm]:WO,[Em]:HO}:{[mm]:ZO,[Em]:kO},o=null;for(let a=0;a<this.se.layers.length-1;a++){let l=this.se.layers[a],h=this.se.layers[a+1],d=Math.min(l[t.be],h[t.be]),p=Math.max(l[t._t],h[t._t])-d,g=this.ve?n.be:n._t,m=this.ve?n._t:n.be,E=l[g],x=h[m]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.se.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.se.regions.push(S),this.hi[A.id]=S;let R=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,O=this.axis===0?f.top:f.left;if(v<O){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:O-v,height:this.axis===0?O-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.se.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.Bo(A,T,S,P,!0),R=P}}S.gateDown=this.Bo(A,T,R,f,!0),o!=null&&(S.gateUp=this.Bo(A,T,o,S,!1))}o=f}let s=this.se.layers[this.se.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.se.regions.push(d),this.hi[l.id]=d,o!=null&&(d.gateUp=this.Bo(l,h,o,d,!1))}return this.se.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.R.entryMap[h.id],p=this.R.entryMap[d.id],g=this.hi[u.id],m=this.hi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.se.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.se.gateMap[T])}E.push(m.gateUp)}else{E.push(g.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.se.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.se.gateMap[T])}m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.se.edgeRoutingMap[l.id]=x,this.se.edgeRouting.push(x),e[l.id]=E}),e}Bo(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.ve?l+(o?0:h):l+(o?h:0);return this.Fg(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}Fg(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.se.gates.push(l),this.se.gateMap[l.id]=l,l}};function dN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,g)=>{let m=jn(p.source),y={edge:p,isSource:m===g,sourceVertex:m,targetVertex:jn(p.target)};return h.push(y),y};z(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(g=>{(Ke(g.source,i)&&!Ke(g.target,i)||Ke(g.target,i)&&!Ke(g.source,i))&&u(g,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let g=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[g]||(o[g]={id:g,edges:new Set},e.push(o[g])),o[g].edges.add(h[p].edge),h[p].isSource?(s[g]||(s[g]={id:g,edges:new Set},t.push(s[g])),s[g].edges.add(h[p].edge)):(a[g]||(a[g]={id:g,edges:new Set},n.push(a[g])),a[g].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function uN(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Gc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"Q");c(this,"en",{});c(this,"At",{});c(this,"Fo",null);c(this,"Vh",[]);c(this,"Gh",new Map);c(this,"ba");c(this,"Ne");c(this,"di");c(this,"pi",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"$h");c(this,"adjacentVertices",{});this.Q=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.$h=e.setPosition,this.ba=e.getSize,this.Fo=e.rootNode,this.Ne=e.edgeNodeSize,this.di=e.edgeFilter}nextRoot(){let r=this.pi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.en[r]}setRootNode(r){this.Fo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.At[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}Bh(){let r={width:50,height:50};return this.axis===0?r.width=this.Ne:r.height=this.Ne,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.Q.x:this.Q.y}getPaddingInOtherAxis(){return this.axis===0?this.Q.x:this.Q.y}initialize(){this.pi.length=0,this.Vh.length=0,this.Gh.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this.At[e.id]=this.ba(e.id),this.en[e.id]=e;let n=dN(e,this.di);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:uN(n),size:this.ba(e.id),type:ll,layer:-1,vertexSet:null};this.pi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.Vh.push(o),this.Gh.set(e.id,o))}this.pi.sort((t,n)=>{let o=this.Fo?this.Fo.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.pi.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function $c(i){return i.parents.length>0?i.parents[0].loc:null}function fm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function pN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function JO(i){return i.parents.length>0?i.parents[0].childGroup:null}function gN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Bc=class{constructor(r,e){this.model=r;c(this,"mn",-1/0);c(this,"gn",1/0);c(this,"Dr");c(this,"Yt");c(this,"ve");c(this,"P",[]);c(this,"Nr",[]);c(this,"ei",{});c(this,"Q");c(this,"J");c(this,"Ct");c(this,"ue");c(this,"ti");c(this,"xe");c(this,"St");c(this,"D");c(this,"ri");c(this,"Ot");c(this,"ni");c(this,"De",[]);c(this,"ne",new Map);c(this,"ua",{center:r=>$c(r)+fm(r,this.J)/2-(r.size-this.J)/2,start:r=>$c(r),end:r=>$c(r)+fm(r,0)-(r.size-this.J)});c(this,"j");c(this,"Pt");c(this,"Xt");c(this,"ii");c(this,"ya",{center:(r,e,t)=>(e+t)/2-fm(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Dr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Yt=e.compress===!0,this.St=e.absoluteBacked===!0,this.j=e.idFunction,this.Pt=e.sizeFunction,this.Xt=e.childVerticesFunction,this.ii=e.absolutePositionFunction,this.ue=e.axisIndex,this.xe=this.ue!==1,this.ti=this.ue===0?1:0,this.ri=this.xe?Ee:Q,this.Ot=this.xe?ve:De,this.ni=this.xe?De:ve,this.ve=e.invert===!0,this.D=e.alignment||Ic,this.Q=e.padding,this.J=this.xe?this.Q.x:this.Q.y,this.Ct=this.xe?this.Q.y:this.Q.x}execute(){let r,e,t;for(let n=0;n<this.Dr.length;n++){r=this.Dr[n];let o=this.Pt(r.id),s=this.qe(r,o,0,null,null),a=0;s.root=!0,a=this.oi(s,0);let l=0,h,d,u=(g,m)=>this.Yt&&g.parents&&g.parents.length>0?this.ne.get(this.j(g.parents[0].node)).position[this.ri]+this.pa(g,this.ti)+this.Ct:m,p=!1;if(a===0&&this.St===!0){let g=this.ii(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.si(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.P.length;e++){for(this.P[e].otherAxis=l,t=0;t<this.P[e].entries.length;t++)h=this.ue===0?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),d=this.ue===1?this.P[e].entries[t].loc:u(this.P[e].entries[t],l),this.si(this.j(this.P[e].entries[t].node),{x:h,y:d},e);this.ve?e<this.P.length-1&&(this.P[e].otherAxisSize=this.De[e+1]+this.Ct,l-=this.P[e].otherAxisSize):(this.P[e].otherAxisSize=this.De[e]+this.Ct,l+=this.P[e].otherAxisSize)}}return this.ne}si(r,e,t){this.ne.set(r,{position:e,layer:t});let n=this.Pt(r),o=this.ue===0?e.x+n.width:e.y+n.height,s=this.ue===0?e.x:e.y;this.mn=Math.max(this.mn,o),this.gn=Math.min(this.gn,s)}ht(r){let e=this.P[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.P[r]=e),e}qe(r,e,t,n,o){let s=this.ht(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Ot],children:[]},l=e[this.ni];return this.De[t]==null?this.De[t]=l:this.De[t]=Math.max(this.De[t],l),s.pointer+=e[this.Ot]+(r.type===Tr?0:this.J),s.entries.push(a),n&&n.children.push(a),a}ma(r,e){let t=this.Nr[e];t||(t=[],this.Nr[e]=t),r.index=t.length,t.push(r)}ga(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.ht(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.J)}}pa(r,e){let t=r.parents.map(n=>n.dimensions[e===0?ve:De]);return Math.max.apply(null,t)}Ea(r){if(r.size>0){let e=this.ua[this.D](r),t=this.Nr[r.depth],n=this.D==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.D==="end"?u.loc-r.size:u.loc+u.size+this.J}this.D!=="end"&&e>=n||this.D==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.D==="end"?r.nodes.length-1:0,l=this.D==="end"?-1:r.nodes.length,h=this.D==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.J;o!==0&&this.fa(r),this.ma(r,r.depth)}}xa(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.ya[this.D](r,e,t),o=n-$c(r);if(this.ga(r,n),!pN(r)){let s=JO(r),a=gN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}fa(r){let e=r;for(;e!=null;)this.xa(e),e=JO(e)}oi(r,e){if(this.ei[r.node.id])return;this.ei[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:G()},n=[],o,s={},a=this.ht(e+1),l=this.Xt(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Pt(this.j(h)),u=a.entries.find(p=>this.j(p.node)===this.j(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,g=$c(u),m=fm(u,this.J),E=g+m/2,y=E-p;y>0&&this.Ug(u,y,r)}else{let p=this.qe(h,d,e+1,r,t);t.nodes.push(p);let g=d[this.Ot];t.size+=g+this.J,n.push(p)}s[h.id]=!0}}for(this.Ea(t),o=0;o<n.length;o++)this.oi(n[o],e+1);return l.length}Ug(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var Fc=class extends bs{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"Ht");c(this,"kt");c(this,"Q");c(this,"En");c(this,"yn");c(this,"D");c(this,"Ne");c(this,"mi");n=n||{},this.Q=n.padding||{x:50,y:50},this.En=n.unattachedRootPadding||150,this.Ht=n.lastPlacements,this.yn=n.strategy||"parent",this.Ne=n.edgeNodeSize,this.mi=n.gatherUnattachedRoots,this.D=n.alignment||"center"}zg(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ne:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.Ht?this.Ht.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(m=>this.zg(m.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(m=>m.mainAxis))},g=this.model.getNodeSizeInMainAxis(e);return n=this.yn==="center"?(p.biggestLayer-g)/2:this.yn==="start"?0:p.biggestLayer-g,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.yn==="parent"?this.Yg(p,l):this.Xg(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}Xg(e,t,n,o,s,a,l,h,d){let u=s,p;for(let g=0;g<e.length;g++){this.kt=e[g],t=this.yn==="center"?(o.biggestLayer-l[g].mainAxis)/2:this.yn==="start"?0:o.biggestLayer-l[g].mainAxis,u=s;for(let m=0;m<this.kt.entries.length;m++){p=this.kt.entries[m];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ne:y,A=n===0?y:this.Ne;p.loc={x,y:f,w:b,h:A},u+=this.Ne+h}else this.vertexSet.setPosition(p.obj,x,f,g),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),g<e.length-1&&(this.model.invert?a-=l[g+1].otherAxis+2*d:a+=l[g].otherAxis+2*d)}}Yg(e,t){let n=new Bc(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.Q,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.D,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let g=[];if(u<this.vertexSet.layers.length-1){let m=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);g.push(...m)}return g},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.mn,a=n.gn,l=0,h=0;if(this.mi&&o.size===1&&this.Ht!=null){let d=this.Ht.rootPosition+this.Ht.rootSize+this.En;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.Ht){let d=this.Ht.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var Uc=class{constructor(r,e){this.R=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"Fh",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.Uh(r),o=dt(e),s;return o?(s={id:G(),obj:e,previous:null,size:this.R.Bh(),next:null,leaf:!1,type:Tr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.R.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.R.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.R.assignedVertices.set(e.id,r),this.Fh.push(s),s}findLayerIndex(r){var e;return(e=this.Fh.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.Uh(r),o=this.R.Bh();this.R.assignedVertices.set(e.id,r);let s={id:G(),obj:e,size:o,leaf:!1,type:Tr,layer:r,vertexSet:this};e.entries.push(s),this.R.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.R.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.R.layout.absoluteBacked)this.xn(r,e,t,n);else{let o=this.R.layout.model.getVertex(r),s=this.R.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.xn(r,s.x,s.y,n):this.xn(r,e,t,n)}}setPosition(r,e,t,n){if(!this.R.layout.absoluteBacked)this.xn(r.id,e,t,n);else{let o=this.R.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.xn(r.id,o.x,o.y,n):this.xn(r.id,e,t,n)}}Uh(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}xn(r,e,t,n){this.R.$h(r,e,t,n);let o=this.layers[n],s=this.R.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var Jx="Hierarchy",go=class extends Hn{constructor(e){super(e);c(this,"type",Jx);c(this,"axis");c(this,"model");c(this,"En");c(this,"ci");c(this,"li");c(this,"ve");c(this,"mi");c(this,"zh");c(this,"pn");c(this,"Yh");c(this,"D");c(this,"Xh");c(this,"ai");c(this,"Ne");c(this,"di");c(this,"Aa");c(this,"routingInformation");c(this,"resultSets",[]);this.En=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.ci=e.options.maxIterationsWithoutImprovement||5,this.li=e.options.maxIterations||24,this.Yh=e.options.rootNode,this.pn=e.options.getRootNode,this.Xh=e.options.placementStrategy,this.Ne=e.options.edgeNodeSize||gm,this.ve=e.options.invert===!0,this.mi=e.options.gatherUnattachedRoots===!0,this.D=e.options.alignment||Ic,this.zh=e.options.generateRouting===!0,this.di=e.options.edgeFilter,this.Aa=e.options.filteredEdgeProcessor,this.ai=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.pn?this.pn():this.Yh;this.model=new Gc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.En,edgeNodeSize:this.Ne,edgeFilter:this.di},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:gm}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new Uc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Mc(this.model,d);u.execute(l),new As(d,(m,E,y)=>this.model.getAdjacentEntries(m,E,y),{maxIterations:this.li,maxIterationsWithoutImprovement:this.ci}).execute(),h=new Fc(this.model,d,{padding:this.padding,strategy:this.Xh,edgeNodeSize:this.Ne,lastPlacements:h,gatherUnattachedRoots:this.mi,unattachedRootPadding:this.En,alignment:this.D}).execute(l);let p=[];if(d.layers.flatMap(m=>m.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?m.ymax-m.ymin:m.xmax-m.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.Aa){let m=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.Aa(m,this)}let g={};this.zh&&(this.routingInformation=this.model.sets.map(m=>{let E={gates:m.gates,edges:m.edgeRouting,edgeMap:m.edgeRoutingMap,regions:m.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new Vc(this.model,d,this.axis,this.ve,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:g}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(go,"type",Jx),rt.register(go.type,go);var zc=class{constructor(r){this.color=r}generate(r){return this.color}},Ci=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=mN(r);return i.fromString(e)}}};function mN(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function KO(){return new Ci(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var Ss=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=KO(),s=this.assignedColors.find(a=>qx(a,o)<20);for(;s!=null&&n<10;)o=KO(),s=this.assignedColors.find(a=>qx(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},Kx=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function qx(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function Yc(i){let r=X(i)?Ci.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Ci(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new Ci(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function EN(i){let r=X(i)?Ci.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Ci(0,0,0):new Ci(255,255,255)}var ym="empty",qO=[{dx:0,dy:-1,axis:ue,directionFromParent:-1},{dx:1,dy:0,axis:re,directionFromParent:1},{dx:0,dy:1,axis:ue,directionFromParent:1},{dx:-1,dy:0,axis:re,directionFromParent:-1},{dx:-1,dy:-1,axis:En,directionFromParent:-1},{dx:1,dy:-1,axis:kn,directionFromParent:-1},{dx:1,dy:1,axis:En,directionFromParent:1},{dx:-1,dy:1,axis:kn,directionFromParent:1}],QO=[{dx:0,dy:-1,axis:ue,directionFromParent:-1},{dx:1,dy:0,axis:re,directionFromParent:1},{dx:0,dy:1,axis:ue,directionFromParent:1},{dx:-1,dy:0,axis:re,directionFromParent:-1}],Qx=(i,r,e,t)=>QO.filter(n=>n.axis!==e||n.directionFromParent===t),xm=(i,r,e,t)=>{let n=[];switch(e){case kn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case En:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case re:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case ue:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return qO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var vs=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"dt",{});c(this,"gi");c(this,"jh");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.gi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.jh=t*(n+o)}Uo(r,e){return{x:Math.floor((r-this.gi.x)/this.gridCellSize),y:Math.floor((e-this.gi.y)/this.gridCellSize)}}jg(r){let e=this.Uo(r.x,r.y),t=this.Uo(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}kg(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.gi.x+t,s=this.gi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}Hg(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}Wg(r,e,t,n){let o=this.makeKey(r,e);if(this.dt[o]==null){let s=this.kg(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.jh),d=[],u=[],p=!1,g=!1;h.forEach(m=>{if(!p&&(this.sourceId===m.id||this.sourceObstacles.indexOf(m.id)!==-1)&&(p=!0),!g&&(this.targetId===m.id||this.targetObstacles.indexOf(m.id)!==-1)&&(g=!0),!this.Hg(m.id)){let E=px(this.jg(m),this.vertexBorder,this.vertexBorder);u.push(m.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(m.id)}}),this.dt[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:g}}else t&&(this.dt[o].ax=t),n&&(this.dt[o].ay=n);return this.dt[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.Wg(r,e,t,n)}reinitialize(){Object.entries(this.dt).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function Ts(i,r){return i===0&&r===0?void 0:i===0&&r!==0?ue:i!==0&&r===0?re:Math.sign(r)===Math.sign(i)?En:kn}function eb(i,r,e){return e==null?0:e===re?i>0?1:-1:e===ue?r>0?1:-1:e===En?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function bm(i){let r=Ts(i.ox,i.oy);return{axis:r,direction:eb(i.ox,i.oy,r)}}function tb(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?re:ue}function Nr(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return Ts(r,e)}}function rb(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=Ts(r,e);return eb(r,e,t)}}function fN(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Nr(i);return Nr(r)===t?-1:Nr(e)===t?1:0}}var Xc=class{constructor(){c(this,"node")}sort(r,e){return fN(this.node,r,e)}};var jt="group:added",Pi="group:member:added",Cs="group:member:removed",Ie="group:removed",mo="dataLoadStart",Am="dataAppendStart",Ir="dataLoadEnd",Sm="dataAppendEnd",Tm="dataUpdated",yn="graphClearStart",Ht="graphCleared",nb="graphChanged",_e="group:updated",Me="node:updated",or="port:updated",ft="edge:updated",sr="edge:added",kt="node:added",yt="edge:removed",Re="node:removed",Wn="port:added",Mr="port:removed",qr="edge:target",Qr="edge:source",ar="select",lr="deselect",vr="selection:cleared",Zn="edge:geometry",Jn="edge:pathEdited",jc="edge:typeChanged",Hc="node:typeChanged",kc="port:typeChanged",Wc="group:typeChanged",ib="group:move:start",Zc="group:move",Vr="group:move:end",Jc="internal:group:sizeChanged",Kc="internal:group:sizeChangedRedo",qc="internal:group:sizeChangedUndo",ob="renderer:added",Ps="node:move:start",er="node:move",It="node:move:end",Qc="node:move:abort",Os="undoredo:update",sb="undo",ab="redo",Oi="destroy";var yN=[kt,Wn,sr,jt,Re,Mr,yt,Ie,Me,or,ft,_e,It,Vr,Qr,qr,Pi,Cs],_s=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},hl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"zo",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||Xt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.zo==null?this.zo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.zo),this.zo=setTimeout(o,e.debounceTimeout))};_s(this,mo,()=>{n=!0}),_s(this,Ir,()=>{n=!1}),_s(this,yn,()=>{n=!0}),_s(this,Ht,()=>{n=!1}),_s(this,Tm,s),_s(this,Jn,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},ed=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(Tm)};yN.forEach(t=>_s(this,t,e))}};var lb="mixed",td="isolated",hb="nodesOnly",cb="groupsOnly",db="edgesOnly",Rs=class Rs extends Vt{constructor(e,t){super();this.instance=e;c(this,"Wt",1/0);c(this,"kh",1/0);c(this,"Hh",1/0);c(this,"ae",[]);c(this,"K",[]);c(this,"q",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ie",{});c(this,"Mr");c(this,"Yo",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.Mr=t.mode||lb,this.instance.bind(Re,n=>{this.Rt(n.node)}),this.instance.bind(Ie,n=>{this.Rt(n.group)}),this.instance.bind(Mr,n=>{this.Rt(n.port)}),this.instance.bind(yt,n=>{this.Rt(n.edge)}),this.instance.bind(qr,n=>{this.Ie[n.edge.getFullId()]&&this.fire(qr,n)}),this.instance.bind(Qr,n=>{this.Ie[n.edge.getFullId()]&&this.fire(Qr,n)}),this.instance.bind(kt,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(jt,n=>{this.generator&&this.autoFill&&!this.Yo&&this.reload()}),this.instance.bind(Me,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(Me,n)}),this.instance.bind(_e,n=>{this.Ie[n.vertex.getFullId()]&&this.fire(_e,n)}),this.instance.bind(ft,n=>{this.Ie[n.edge.getFullId()]&&this.fire(ft,n)}),this.instance.bind(or,n=>{n.port!=null&&this.Ie[n.port.getFullId()]&&this.fire(or,n)}),this.instance.bind(Ht,()=>{this.clear()}),this.instance.bind(Ir,()=>{this.reload()}),this.setCapacityPolicy(Rs.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.ae.length===0&&this.K.length===0&&this.q.length===0}Wh(e){return e.objectType===Be.objectType?this.q:e.objectType===de.objectType?this.ae:this.K}setMode(e){this.Mr=e,e===td?this.Zg():e===db?this.Zh():e===hb?(this.Sa(),this.Jh()):e===cb&&(this.Sa(),this.Kh())}Jg(e){let t=[],n=this.Wh(e),o=e.objectType===Be.objectType?this.kh:e.objectType===de.objectType?this.Wt:this.Hh;if(n.length>=o){if(this.capacityPolicy===Rs.DISCARD_NEW)return!1;t=n.splice(0,1),this.Ta(t[0],":removed"),delete this.Ie[t[0].getFullId()]}return n.push(e),this.Ta(e,":added"),t}Ta(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}qh(e,t){if(this.Kg(e)&&!this.Ie[e.getFullId()]){let n=this.Jg(e);return n===!1?[[],[]]:(this.Ie[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}Kg(e){return this.Mr===lb||this.Mr===hb&&e.objectType===de.objectType||this.Mr===cb&&e.objectType===ie.objectType||this.Mr===db&&e.objectType===Be.objectType?!0:this.Mr===td?e.objectType===Be.objectType?this.ae.length===0&&this.K.length===0:this.q.length===0:!1}Rt(e,t){let n=e.getFullId();return wt(this.Wh(e),s=>s.getFullId()==n)?(delete this.Ie[e.getFullId()],t&&t(e,!1),this.Ta(e,":removed"),[[],[e]]):[[],[]]}qg(e,t){return this.Ie[e.getFullId()]?this.Rt(e,t):this.qh(e,t)}va(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(X(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.ze)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.va(e,this.Rt.bind(this),t)}append(e,t){return this.va(e,this.qh.bind(this),t)}toggle(e,t){return this.va(e,this.qg.bind(this),t)}setMaxNodes(e){this.Wt=e}setMaxGroups(e){this.Hh=e}setMaxEdges(e){this.kh=e}setCapacityPolicy(e){this.capacityPolicy=e}Sa(){for(let e=this.q.length,t=0;t<e;t++)this.Rt(this.q[0])}Kh(){for(let e=this.ae.length,t=0;t<e;t++)this.Rt(this.ae[0])}Jh(){for(let e=this.K.length,t=0;t<e;t++)this.Rt(this.K[0])}Zh(){this.Kh(),this.Jh()}Zg(){this.Zh(),this.Sa()}clear(e){this.ae.length=0,this.q.length=0,this.K.length=0,this.Ie={},this.fire(yn),e||this.onClear(this)}Qg(e){let t=[];for(let n=0;n<e.length;n++)this.Ie[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Yo=!0,this.fire(mo,{}),this.generator(this,this.instance),this.fire(Ir,{}),this.onReload&&this.onReload(),this.Yo=!1)}ze(e,t){let n=t===Be.objectType?this.q:t===ie.objectType?this.K:this.ae;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.ze(e,de.objectType)}eachGroup(e){this.ze(e,ie.objectType)}eachVertex(e){this.ze(e,de.objectType),this.ze(e,ie.objectType)}eachEdge(e){this.ze(e,Be.objectType)}getNodeCount(){return this.ae.length}getNodeAt(e){return this.ae[e]}getNodes(){return this.ae}getNode(e){return this.ae.find(t=>t.id===e)}getGroupAt(e){return this.K[e]}getGroups(){return this.K}getGroup(e){return this.K.find(t=>t.id===e)}getGroupCount(){return this.K.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.ae),Array.prototype.push.apply(e,this.q),Array.prototype.push.apply(e,this.K),e}getAllEdgesFor(e,t){return this.Qg(e.getAllEdges(t))}getEdgeCount(){return this.q.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.q[e]}getEdges(){return this.q}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}eE(e){return new Rs(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.eE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c(Rs,"DISCARD_EXISTING","discardExisting"),c(Rs,"DISCARD_NEW","discardNew");var hr=Rs;var _i=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"Ca");c(this,"Oa");c(this,"Ei");c(this,"Qh");c(this,"ed");c(this,"td");c(this,"rd");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.Ca=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Oa=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Ei=r.geometry,r.source.dummy&&(this.Qh=!0,this.td={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.ed=!0,this.rd={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.Qh?this.td:this.Ca==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.Ca}generateTargetIdentifier(){return this.ed?this.rd:this.Oa==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Oa}qe(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Ei},e=this.instance.$_addEdge(r,Rx,null);this.manager.edgeChange(this.edgeId,e)}et(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Cm=class extends _i{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.et()}redo(){this.qe()}hasDeltas(){return this.obj!=null}},Pm=class extends _i{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.qe()}redo(){this.et()}hasDeltas(){return this.obj!=null}},vm=class extends _i{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return bi(this.newVertex)&&bi(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!bi(this.newVertex)&&!bi(this.oldVertex)&&Ax(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Om=class extends vm{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},_m=class extends vm{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var Eo=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=G()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof _i&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];ub(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):pb(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):gb(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Ls=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var rd=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===de.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===ie.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}nd(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},dl=class extends rd{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.nd()}redo(){this.$add()}},cl=class extends rd{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.nd()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},nd=class extends cl{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},ul=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.Vr(Kc,this.newGroupSize,this.originalGroupSize)}undo(){this.Vr(qc,this.originalGroupSize,this.newGroupSize)}Vr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function ws(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function xN(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function id(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Ri=class{constructor(r,e,t,n){this.obj=r;this.instance=t;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=ws({},r.data),this.$od=ws({},e),this.reason=n}od(r){this.obj.objectType===de.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===ie.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===he.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Be.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.od(this.$od)}redo(){this.od(this.$nd)}hasDeltas(){return!el(this.$nd,this.$od)}};var od=class{constructor(r,e,t){this.obj=r;this.bn=e;this.instance=t}qe(){this.instance.addPort(this.bn,this.obj.data)}et(){this.instance.removePort(this.bn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},sd=class extends od{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.et()}redo(){this.qe()}hasDeltas(){return this.obj!=null}},ad=class extends od{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.qe()}redo(){this.et()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Rm=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},ld=class extends Rm{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this._a=o;this.Pa=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Pa!=null&&this.renderer.setPosition(this.node.id,this.Pa.x,this.Pa.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this._a!=null&&this.renderer.setPosition(this.node.id,this._a.x,this._a.y)}},hd=class extends Rm{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.La=o;this.Ra=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Ra!=null&&this.renderer.setPosition(this.node.id,this.Ra.x,this.Ra.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.La!=null&&this.renderer.setPosition(this.node.id,this.La.x,this.La.y)}},cd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},dd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var pl=class{constructor(r,e,t){this.wa=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.wa.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var mb="internal.connection",ud="internal.element:repainted",gl="context:update",pd="group:collapse",gd="group:expand",Kn="zoom",md="render:start",xn="render:end",Eb="adhocLayout",Ds="afterLayoutRefresh",ml="group:relayout",Gr="group:render",Ns="internal.vertex:updated",$r="node:render",Ed="node:visibility",fd="plugin:added",fb="plugin:removed",bn="relayout",yb="objectRepainted",Fe="click",xt="contextmenu",fo="dblclick",Br="dbltap",xb="focus",pe="mousedown",Lm="mouseenter",wm="mouseexit",oe="mousemove",bb="mouseleave",se="mouseup",it="mouseout",ot="mouseover",W="tap",Ab="touchstart",Sb="touchend",Tb="touchmove",vb="vertex:click",Cb="vertex:dblclick",Pb="vertex:dbltap",Ob="vertex:mouseout",_b="vertex:mouseover",Rb="vertex:mousemove",bN="vertex:mouseup",AN="vertex:mousedown",Lb="vertex:contextmenu",wb="vertex:tap",Db="edge:click",Nb="edge:dblclick",Ib="edge:dbltap",yd="edge:mouseout",xd="edge:mouseover",Mb="edge:mouseup",El="edge:mousedown",Vb="edge:contextmenu",Gb="edge:tap",yo="canvasClick",$b="canvasDblClick",bd="edge:redraw",Bb="lasso:end",fl="pan",An="modeChanged",SN="allGroupsRelayout",Fb="groupRelayoutAdhoc",TN="groupMemberRemoved",Ub="newVertexAddedToGroup",zb="existingVertexAddedToGroup";var yl=class extends Ri{constructor(e,t,n,o){super(e,t,n,o);this.obj=e;this.instance=n;c(this,"type","vertexUpdate");o===Is&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Ms=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var Yb=class{constructor(r,e,t,n,o){this.T=r;this.tE=e;this.ad=t;this.Ei=n;this.wa=o;c(this,"type","edgePath")}sd(r){this.T.setEdgeGeometry(this.tE,r,null,this.wa)}undo(){this.sd(this.ad)}redo(){this.sd(this.Ei)}hasDeltas(){return!el(this.ad,this.Ei)}},vN=50,Xb="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",CN="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",Ad=class{constructor(r){c(this,"T");c(this,"Xo");c(this,"Lt");c(this,"Da");c(this,"undoStack");c(this,"redoStack");c(this,"Na",[]);c(this,"le");c(this,"Zt",0);this.T=r.instance,this.Lt=!1,this.undoStack=[],this.redoStack=[],this.Xo=r.maximumSize||vN,this.Da=r.onChange,this.rE()}ld(r){this.Lt=r}dataLoadStart(){this.clear(),this.ld(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.ld(!1)}dataAppendEnd(){this.dataLoadEnd()}rE(){this.T.bind(Ht,()=>{this.clear()}),this.T.bind(kt,r=>{this.command(new dl(r.node,this.T))}),this.T.bind(Re,r=>{this.command(new cl(r.node,this.T))}),this.T.bind(Me,r=>{Qa(r.updates)||this.command(new yl(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(jt,r=>{this.command(new dl(r.group,this.T))}),this.T.bind(Ie,r=>{this.command(new nd(r,this.T))}),this.T.bind(_e,r=>{Qa(r.updates)||this.command(new yl(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(Jc,r=>{let e=new ul(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(sr,r=>{this.command(new Cm(r.edge,this.T,this))}),this.T.bind(yt,r=>{this.command(new Pm(r.edge,this.T,this))}),this.T.bind(ft,r=>{Qa(r.updates)||this.command(new Ri(r.edge,r.originalData,this.T,r.reason))}),this.T.bind(Qr,r=>{this.command(new Om(this.T,this,r.edge,r.old,r.new))}),this.T.bind(qr,r=>{this.command(new _m(this.T,this,r.edge,r.old,r.new))}),this.T.bind(Jn,r=>{this.command(new Yb(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(Wn,r=>{this.command(new sd(r.port,r.vertex,this.T))}),this.T.bind(Mr,r=>{this.command(new ad(r.port,r.vertex,this.T))}),this.T.bind(or,r=>{Qa(r.updates)||this.command(new Ri(r.port,r.originalData,this.T,null))}),this.T.bind(Pi,r=>{r.vertexIsNew!==!0&&this.command(new ld(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(Cs,r=>{this.command(new hd(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(Hc,r=>{this.command(new Ms(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(kc,r=>{this.command(new Ms(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Wc,r=>{this.command(new Ms(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(jc,r=>{this.command(new Ms(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(It,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ls(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Vr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ls(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(pd,e=>{this.command(new cd(e.group,r.renderer))}),r.renderer.bind(gd,e=>{this.command(new dd(e.group,r.renderer))}),r.renderer.bind(Re,e=>{this.command(new pl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Ie,e=>{this.command(new pl(r.renderer,e.vertex,e.pos))})})}fi(){this.Da&&this.Da(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Lt){if(!r.hasDeltas())return;r_(r)&&(r=r.compress()),this.le!=null?this.le.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.Xo&&this.undoStack.splice(this.undoStack.length-this.Xo-1,this.undoStack.length-this.Xo),this.redoStack.length=0,this.fi())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof _i&&o.edgeId===r?o.edgeChange(e):o instanceof Eo&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Lt=!0,this.redoStack.push(r),r.undo(),this.Lt=!1,this.fi())}redo(){let r=this.redoStack.pop();r&&(this.Lt=!0,this.undoStack.push(r),r.redo(),this.Lt=!1,this.fi())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.le=null,this.Zt=0,this.Lt=!1,this.fi()}transaction(r,e,t){if(this.le!=null&&e==null)return U(Xb),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.le;return this.le=null,this.command(a),a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.le!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.nE(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}nE(r,e){e instanceof Eo?e.$mergeInto(r):r.addAction(e,!0)}iE(){return this.le=new Eo,this.Zt=0,this.le.id}openTransaction(r){if(!this.Lt){let e=!0;if(this.le!=null)if(r!=null)if(r===e_)this.commitTransaction();else if(r===t_)this.rollbackTransaction();else if(r===ut)e=!1,this.Zt++;else throw new Error(Xb);else throw new Error(Xb);return e&&this.iE(),this.le.id}return null}rollbackTransaction(){this.le!=null&&(this.Zt>0?(this.Zt--,U(CN)):(this.le.undo(),this.le=null,this.fi(),this.Na.length=0))}commitTransaction(r){if(this.le!=null)if(r!==!0&&this.Zt>0)this.Zt--;else{let e=this.le;this.le=null,this.command(e),this.Zt=0,this.oE()}}oE(){this.le==null&&(this.Na.forEach(r=>{try{r()}catch(e){}}),this.Na.length=0)}},e_="commitCurrent",t_="rollbackCurrent",ut="appendToCurrent";function r_(i){return i instanceof Eo}function ub(i){return i instanceof Ri||i instanceof yl}function pb(i){return i instanceof Ls}function gb(i){return i instanceof ul}var Dm="1.1.3";var jb="type",Hb="default",Jb="groupResized",n_="addPort",i_="addNewPort",o_="removePort",Sd="updatePort",Vs="moved",PN="layout",Nm="updateVertex",kb="updateNode",Wb="updateGroup",Kb="magnetizer",vd="setPosition",qb="snapToGrid",ON="sizeGroupToFit",xl="drawingToolsResize",Is="rotation",Qb="resized",Zb="updated",Td=class extends Vt{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"Ia");c(this,"cd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"hd");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"pe");c(this,"Gr",new Map);c(this,"yi",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new Ad({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Os,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||Jg,this.typeProperty=e.typeProperty||jb,this.edgeTypeProperty=e.edgeTypeProperty||jb,this.portTypeProperty=e.portTypeProperty||jb,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||Hb),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||Hb),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||Hb),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new vc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!ir(a)?{}:a,a=lt(a),a.id=a.id||G(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||Bx,this.modelTopAttribute=e.modelTopAttribute||Fx,this.modelWidthAttribute=e.modelWidthAttribute||zx,this.modelHeightAttribute=e.modelHeightAttribute||Yx,this.modelRotationAttribute=e.modelRotationAttribute||Ux,this.yi=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.cd=e.autoSave&&e.autoSave.enabled!==!1,this.hd={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],g=u==null?1/0:u,m=p==null?1/0:p;return g-m}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new rl(this.hd),this.cd&&(this.autoSaver=new hl(this,e.autoSave)),new ed(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),g=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),m=K(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(g.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||m.allowLoopback===!1):h===d?!(g.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||m.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.pe=this.jo(o=>{this.L(s=>s.$selectionCleared(o)),this.fire(vr,{selection:o})}),e.selectionMode&&this.pe.setMode(e.selectionMode),e.maxSelectedNodes&&this.pe.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.pe.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.pe.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.pe.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}sE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}ko(e,t,n,o){if(X(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||z(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.dd(this.sE(t,{x:a,y:l},n),o),!0]}}jo(e){return new hr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.jo();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new hl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.Ma(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.Ma(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},nl,null))),t}clear(){return this.L(e=>e.$graphClearStart()),this.fire(yn),this.graph.clear(),this.$transientVerticesByRenderer={},this.L(e=>e.$graphClearEnd()),this.fire(Ht),this}destroy(){this.clear(),delete this.Gr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.yi[e]=t}getDescendants(e){return fs(e)}getAncestors(e){return gn(e)}isAncestor(e,t){return Ke(e,t)}isDescendantGroup(e,t){return Ox(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=X(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===de.objectType?this.typeProperty:e.objectType===he.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t)}$dispatchTypeChange(e,t,n){let o,s;K(e)?(o=Hc,s=()=>this.L(a=>a.$nodeTypeChanged(e,t,n))):H(e)?(o=kc,s=()=>this.L(a=>a.$portTypeChanged(e,t,n))):tt(e)?(o=jc,s=()=>this.L(a=>a.$edgeTypeChanged(e,t,n))):z(e)&&(o=Wc,s=()=>this.L(a=>a.$groupTypeChanged(e,t,n))),o!=null&&(this.fire(o,{obj:e,previousType:t,newType:n}),s())}resolveFullId(e){if(tt(e))return e.id;if(K(e))return e.id;if(z(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=G());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e.group!=null)if(o=this.getGroup(e.group),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e.group+"] not found");return this.Ma(s,o),o!=null&&this.fire(Pi,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}Ma(e,t){let n={node:e,parentGroup:t};this.L(o=>o.$nodeAdded(n)),this.fire(kt,n)}aE(e,t){let n={group:e,parentGroup:t};this.L(o=>o.$groupAdded(n)),this.fire(jt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}ud(e){return Es(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.ud(t);o[n.id]=n,n.transientRenderer=t.id}return n}dd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.L(o=>{o.$renderDummyVertex(n)}),n}Ho(e){this.graph.deleteNode(e),this.L(t=>{t.$nodeRemoved({node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.dd({id:`${e.id}_${n===nt?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===nt?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.ud(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:Lx},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.yi[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=G()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e.group!=null){if(n=this.getGroup(e.group),n==null)throw new Error("Cannot find parent group ["+e.group+"]");this.graph.$addMemberToGroup(o,n)}this.aE(o,n),n!=null&&this.fire(Pi,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.yi[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:G(),group:h.id}),g=this.addNode(p);s.set(u,g.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,g=Object.assign({},d,{id:G(),group:h.id});p&&typeof p!="string"&&delete g.groupTemplate;let m=this.addGroup(g);if(s.set(u,m.id),p)if(typeof p=="string"){let E=this.yi[p];if(E)try{a(E,m)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,m)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),g=s.get(u[0])||u[0],m=s.get(p[0])||p[0],E=u[1]==null?g:[g,u[1]].join(this.portSeparator),y=p[1]==null?m:[m,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data.group=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.L(p=>{p.$groupMemberAdded(u)}),this.fire(Pi,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.L(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data.group,this.fire(Cs,h)}return l}pd(e,t,n,o){e.nestedGroups.forEach(a=>this.pd(a,t,!0,o)),e.nodes.forEach(a=>this.md(a,!0,o));for(let a=0;a<e.edges.length;a++)this.Va(e.edges[a]);let s={group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.L(a=>a.$groupRemoved(s)),o||this.fire(Ie,s)}md(e,t,n){for(let s=0;s<e.edges.length;s++)this.Va(e.edges[s]);let o={node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.L(s=>s.$nodeRemoved(o)),n||this.fire(Re,o)}removeGroup(e,t,n){let o=this.graph.getVertex(X(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data.group),this.pd(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!X(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(X(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.md(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,nl,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.ko(e.source,s,0,n),[h,d]=this.ko(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),g={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.L(m=>m.$edgeAdded(g,e.context)),o||this.fire(sr,g,null),p}else return this.debugEnabled&&U("Could not add edge"),null}Va(e,t){let n={edge:e,source:t};this.L((o,s)=>o.$edgeRemoved(n)),this.fire(yt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.Ho(n.source),n.target.dummy&&K(n.target)&&this.Ho(n.target),this.Va(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.ko(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.Ho(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.L(h=>{h.$edgeTargetChanged(l)}),this.fire(qr,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.ko(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.Ho(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.L(h=>{h.$edgeSourceChanged(l)}),this.fire(Qr,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.Wo(o,i_);let h={vertex:o,data:s,port:l};this.L(d=>d.$portAdded(h)),this.fire(Wn,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.Wo(n,n_);let s={vertex:n,data:t,port:o};return this.L(a=>a.$portAdded(s)),this.fire(Wn,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else H(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.Wo(n,o_);let a={vertex:n,port:o,edges:s};return this.L(l=>l.$portRemoved(a)),this.fire(Mr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&z(n.obj))this.removeGroup(n.obj);else if(n.obj&&tt(n.obj))this.removeEdge(n.obj);else{for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Gr)this.Gr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,Wb,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,kb,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,Nm,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===de.objectType?Me:_e;this.gd(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||Nm,source:s}))}}updateVertices(e,t){this.lE(e,Nm,!1,t)}lE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,Sd,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.gd(s.obj,t,o,or,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||Sd}))}updateEdge(e,t){this.$_updateEdge(e,t,Zb,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let l in t)s.data[l]==null?s.data[l]=t[l]:zg(s.data,l,t[l]);this.Ed(a,s),this.fire(ft,{edge:s,updates:t||{},originalData:a,reason:n},null)}}update(e,t){this.dn(e,t,null,!1)}dn(e,t,n,o){if(K(e)){let s=n==null?kb:n;this.$_updateVertex(e,t,s,o)}else if(z(e)){let s=n==null?Wb:n;this.$_updateVertex(e,t,s,o)}else if(tt(e)){let s=n==null?Zb:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?Sd:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(Jn,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.L(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new ol(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===de||e.constructor===he||e.constructor===ie||e.constructor===Be?e:X(e)||ir(e)?this.graph.getVertex(e):null}Zo(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.L(l=>{l.$select(a)}),this.fire(ar,a))})}cE(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let g;tt(h)?g=[h]:g=t(h),e.filter&&(g=g.filter(e.filter));for(let m=0;m<g.length;m++){let E=d&&h===this.graph||g[m].source===h||n&&H(g[m].source)&&g[m].source.getParent()===h,y=u&&h===this.graph||g[m].target===h||n&&H(g[m].target)&&g[m].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(g[m])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}Ed(e,t){let n=t.objectType===Be.objectType?this.edgeTypeProperty:t.objectType===he.objectType?this.portTypeProperty:this.typeProperty;if(t.data[n]!=null&&t.data[n]!==e[n]){let o=t.data[n],s=e[n];t.type=o,this.$dispatchTypeChange(t,s,o)}}gd(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===he.objectType?e.getFullId():e.id,h=e.objectType===he.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let p in t)zg(e.data,p,t[p]);e.objectType===he.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.Wo(e.getParent(),Sd))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.L(p=>p.$vertexUpdated(u)),this.Ed(a,e),this.fire(o,u,null)}}Wo(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Ia)){let o=z(e)?_e:Me,s={vertex:e,updates:{},originalData:e.data,reason:t};this.L(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.cE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(tt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.xi(e);this.Zo(t,!1,this.pe,!0)}select(e,t){let n=this.jo(),o=this.xi(e),s=this.Zo(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||z(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}fd(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.fd(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.jo();if(o.obj&&o.obj.objectType===de.objectType){t&&this.Zo(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.fd(o.obj,s,n,a)}return s}xi(e){return e instanceof ol||e instanceof hr?e:X(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>X(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.xi(e);if(t){let n=this.Zo(t,!0,this.pe,!1);n[1]!=null&&n[1].length>0&&this.bi(!1,n[1]),n[0]!=null&&n[0].length>0&&this.bi(!0,n[0])}}bi(e,t){let n=e?ar:lr;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.pe};this.L(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.xi(e);if(t){let n=[],o=this.pe.toggle(t,(s,a)=>{a||n.push(s)});this.bi(!1,o[1]),this.bi(!1,n),this.bi(!0,o[0])}}removeFromSelection(e){let t=this.xi(e);t&&this.pe.remove(t,n=>{let o={obj:n,selection:this.pe};this.L(s=>{s.$deselect(o)}),this.fire(lr,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.pe.clear()}getSelection(){return this.pe}setMaxSelectedNodes(e){this.pe.setMaxNodes(e)}setMaxSelectedEdges(e){this.pe.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.pe.setCapacityPolicy(e)}hE(e){this.fire(e),this.Ia=!1}yd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(g){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=g=>{e.incremental===!1&&this.clear(),this.Ia=!0,t===mo?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.L(m=>m.$dataLoadStart())):t===Am&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.L(m=>m.$dataAppendStart())),this.fire(t),Nx(o,g,this,d),this.hE(n),h&&h(this,g),this.fire(nb),n===Ir?(this.L(m=>m.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===Sm&&(this.L(m=>m.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let g=o===Xt||o===qg?Xt:e.dataType,m=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:g,error:u,headers:m})}return this}load(e){return this.yd(e,mo,Ir)}append(e){return this.yd(e,Am,Sm)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},Qg(e.type||Xt,this,e.parameters)}toJSON(){return Qg(Xt,this,{})}getRenderer(e){return this.Gr.get(e)}L(e,t){this.Gr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||G(),this.Gr.set(t,e),e.id=t,e.onDestroy(n=>{this.Gr.delete(n.id)}),this.fire(ob,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(sb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(ab,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return Dm}$_deriveEdgeId(e){return e==null?G():typeof e=="string"?e:this.edgeIdFunction(e)||G()}};var _N="csv";function s_(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var Im=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=s_(this.lines[0])):this.headers=e.headers}xd(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=s_(t);r(n)}}readLines(r){this.xd(e=>r(e))}readRecords(r){this.xd(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},eA=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new Im(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function tA(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function a_(i,r){return r?i:i.toLowerCase()}function RN(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=St(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var LN=RN;function wN(i){return i=St(i),[{token:i.replace(/\s/g,"_"),context:i}]}function l_(i){return[{token:St(i),context:i}]}function DN(i,r){return i.score>r.score?-1:1}var NN=i=>i.id;function IN(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var MN=10,bl=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"bd",0);c(this,"Ai",new Map);c(this,"$r",[]);c(this,"Jo",0);c(this,"Le",{});r=r||{},this.fields=r.fields,this.root=this.Ga(),this.tokenizer=r.tokenizer||LN,this.searchTokenizer=r.searchTokenizer||l_,this.limit=r.limit||MN,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||NN,this.sorter=r.sorter||DN}Ga(r){return{index:this.bd++,children:{},documentIds:{},key:r}}dE(r,e,t){let n=this.Le[r];n||(n={},this.Le[r]=n),n[e.index]=e}uE(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.Ga(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.dE(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);IN(this.$r,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Ai.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.uE(a_(l[h].token,this.caseSensitive),o,l[h].context)}}),this.Jo++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.Le[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.$r.length;n++)if(this.idFunction(this.$r[n].document)===e){o=n;break}o!==-1&&(this.$r.splice(o,1),this.Jo=this.$r.length),this.Ai.delete(e)}clear(){this.Ai.clear(),this.Le={},this.bd=0,this.$r.length=0,this.Jo=0,this.root=this.Ga()}getDocumentCount(){return this.Jo}getDocumentList(){return this.$r}getDocument(r){return this.Ai.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let g=n[d];g||(g={},n[d]=g,s[d]=0,a[d]=[]),a[d].push(p),g[u]||(g[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let m in d.documentIds)if(d.documentIds.hasOwnProperty(m)){let E=d.documentIds[m];for(let y=0;y<E.length;y++)l(m,p,E[y])}return}let g=p[u];d.children[g]&&h(d.children[g],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,a_(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Ai.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},rA=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new bl(e),this.groupIndex=new bl(e),this.edgeIndex=new bl(e),this.portIndex=new bl(e),r.bind(kt,t=>{this.Ad(t.node)}),r.bind(Re,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Me,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(jt,t=>{this.Sd(t.group)}),r.bind(Ie,t=>{this.groupIndex.remove(t.group.data)}),r.bind(_e,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(sr,t=>{this.Td(t.edge)}),r.bind(yt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(ft,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(Wn,t=>{this.portIndex.add(t.port.data)}),r.bind(Mr,t=>{this.portIndex.remove(t.port.data)}),r.bind(or,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Ht,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Ad(n)}),this.instance.eachGroup((t,n)=>{this.Sd(n)}),this.instance.eachEdge((t,n)=>{this.Td(n)})}Ad(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}Sd(r){this.groupIndex.add(r.data)}Td(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var nA="context",Mm="lookup",iA="default",qn="element",Li="text",xo="tmpl",Qn="each",Al="if",oA="root",sA="class",aA="style",bo="$value",Sl="$key",lA="attribute";function Vm(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return xx(e)}}function cA(i){return i.length>0?i[i.length-1]:null}function dA(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function Gm(i,r,e,t,n){let o=G(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function hA(i,r,e,t,n){e.atts[i]=r,Gm(i,r,e,t,n)}function uA(i,r){let e=Vm(i,r.attributesRe),t={el:St(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?hA(o,"",t,s,r):hA(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=St(e[o]);s!=null&&s.length>0&&n(s)}return t}var VN=["*","-","+","/","%"],h_=["==",">","<",">=","<=","===","!=","!==","||"],GN=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Cd="bool",c_="num",d_="group",u_="var",$N="op",pA="comp",p_="exp",g_="string",m_="array",E_="key",f_="value";function BN(i){return i[i.length-1]}function y_(i){return i.t===d_}function FN(i){return i.t===u_}function UN(i){return i.t===p_}function zN(i){return i.t===c_}function YN(i){return i.t===Cd}function XN(i){return i.t===g_}function jN(i){return i.t===m_}function HN(i){return i.t===E_}function kN(i){return i.t===f_}function x_(i){let r=i.match(GN),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=BN(t);if(e==="("){let s={t:d_,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:m_,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:E_,v:null});else if(e.match(/\$value/))o.c.push({t:f_,v:null});else if(e.match(/^#/))o.c.push({t:p_,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:g_,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Cd,v:!0});else if(e.match(/false/))o.c.push({t:Cd,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:c_,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:u_,v:e}):VN.indexOf(e)!==-1?o.c.push({t:$N,v:e}):h_.indexOf(e)!==-1?o.c.push({t:pA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Cd,v:!1}),o.c.push({t:pA,v:"=="})):(o.c.push({t:Cd,v:!1}),o.c.push({t:pA,v:"!=="})))}return t[0]}function WN(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(h_.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(y_(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,g;for(let m=1;m<l.length;m+=2)g=l[m],(g.v==="+"||g.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,g],v:null},h.push(p)):p.c.push(u,g):(p!=null?p.c.push(u):h.push(u),p=null,h.push(g)),u=o(l[m+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function Tl(i){let r=x_(i);return WN(r)}function wi(i,r,e,t,n){let o=$m(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=$m(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function $m(i,r,e,t,n){let o=i.map(l=>y_(l)?$m(l.c,r,e,t,n):FN(l)?r(l.v):UN(l)?e(l.v):jN(l)?r(bo)[l.index]:HN(l)?r(Sl):kN(l)?r(bo):zN(l)||XN(l)||YN(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var Di=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=G(),r.entries[this.uuid]=this,this.compiledBindings={}}vd(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:G(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Tl(a),once:s,format:l}})})}}};var Bm=class Bm extends Di{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:G(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.vd({[Bm.TEXT_BINDING_NAME]:n})}};c(Bm,"TEXT_BINDING_NAME","__element");var Ni=Bm;var Fm=class Fm extends Di{constructor(e,t){super(t);c(this,"type",Fm.type);c(this,"comment");this.comment=e}};c(Fm,"type","comment");var Gs=Fm;var Um=class Um extends Di{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",Um.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.vd(e.bindings),this.remove=!1}};c(Um,"type",qn);var Fr=Um;var gA={},ei={construct:(i,r,e,t,n,o)=>{let s=gA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{gA[i]=r},exists:i=>gA[i]!=null};var zm=class zm extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",Qn);this.context=e.atts.in,this.key=e.atts.key,this.tag=zm.tag}};c(zm,"tag","r-each");var Pd=zm;ei.register(Pd.tag,Pd);function Ym(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function mA(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];Ym(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Od=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[xe]=this.Cd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}Cd(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(xe);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[xe];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.Cd(n);return this.Od(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[xe]}}Od(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.Od(r.children[n],e);r.children=t}};function b_(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function ZN(i,r){i.el.nodeValue=r}function JN(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(..._d(i,r.children[t]));return e}function _d(i,r){let e=JN(i,r);return r.type===qn?(i.removeElement(r.el),e.unshift(r.el)):r.type===Li?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===Qn&&(r.entryMap={}),e}function A_(i,r,e,t){for(let n in i.bindings)if(n!==sA){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=wi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===qn?n!==aA?b_(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);b_(i,u,h.substring(d+1),!0)}):i.type===Li&&ZN(i,a))}}function S_(){return{added:[],removed:[],elements:[]}}var Xm=class Xm extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Xm.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Tl(this.test)}};c(Xm,"tag","r-if");var Rd=Xm;ei.register(Rd.tag,Rd);function jm(i,r,e,t,n){return i.resolution=wi(i.entry.expression,o=>Ce(r,o),o=>e(o),t,n),i.resolution}var Ao=class extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[nA],this.type=xo,this.remove=!0,e.atts[Mm])this.lookup=e.atts[Mm],this.default=e.atts[iA]||"";else{this.templateId=e.atts.id;let a=dA(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(Ao,"tag","r-tmpl"),ei.register(Ao.tag,Ao);function T_(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(ir(i)){let e=i;for(let t in e)r(e[t],t)}}var So=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"Tt",new Map);c(this,"Ko",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"qo");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.qo=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Pd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.qo[r]!=null?this.qo[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.Tt.clear(),this.Ko.clear()}parseAttributes(r){return Vm(r,this.attributesRe)}_d(r,e){return t=>{let n=e?null:this.Tt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Tt.set(t,n),n}}addTemplate(r,e){this.qo[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.Ko.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.Ko.get(r);if(n==null||t===!0){e=this._d(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=v_(this,o,e,null,[r]);return this.Ko.set(r,s),s}}else return n}data(r,e,t){return Ce(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?Ce(e,t.substring(9)):Ce(r,t)}update(r,e,t){let n=r.$recado,o=S_();return t=t||{},n!=null&&this.An(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}An(r,e,t,n,o){if(r.type===oA)for(let s=0;s<r.children.length;s++)this.An(r.children[s],e,t,n,o);else if(r.type===qn||r.type===Li){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),A_(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Si(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.An(r.children[l],s,t,n,o)}else if(r.type===Al){let s=r,a=s.resolution,l=jm(s,e,h=>this.Si(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)_d(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.An(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===xo){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.An(r.children[a],s,t,n)}else if(r.type===Qn){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)_d(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];T_(a,(u,p)=>{let g=Ce(u,s.entry.key);if(l[g]=u,s.entryMap[g]!=null){let m=s.entryMap[g];for(let E=0;E<m.length;E++)h.push({data:u,key:g,execution:m[E]})}else h.push({data:u,key:g})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],_d(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.An(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(g=>{g.el!=null&&s.placeholder.before(g.el)});else{let g=this.render(r.entry.children,p.data,null,n);mA(s,g,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Od(this,r,e)}parse(r,e,t,n){return v_(this,r,e,t,n)}Si(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:G(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${Qn}:${b}`),entryMap:{},type:Qn,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${xo}:${b}`),entry:f,id:b,children:[],type:xo};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:G(),entry:b,bindings:A,children:[],el:f,type:qn};return h.children.push(S),f.$recado=S,S},g=(f,b,A,T)=>{y(f,T);let S={id:G(),el:f,entry:b,bindings:A,children:[],type:Li};return h.children.push(S),f.$recado=S,S},m=(f,b,A)=>{let T=G(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${Al}:${T}`),type:Al,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,R=null;if(f.type===Al){let v=h,O=m(f,A,o);if(h=O,S=jm(O,b,P=>this.Si(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,O.placeholder,T);h=v,R=O}else if(f.type===Qn){let v=f,O=l,P=f.context===bo?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=G(),_=d(v,C,A);h=_,P!=null&&T_(P,(w,$)=>{let N=v.key&&ir(w)?Ce(w,v.key):$||null;for(let M=0;M<f.children.length;M++){let D=x(f.children[M],w,_.placeholder,$);N!=null&&Ym(_,N,D)}}),l=O,h=I,R=_}else if(f.type===xo){let v=f,O=l,P=h,I=G(),C=u(v,I,A);h=C;let _=f.context==null||f.context.length===0?b:Ce(b,f.context),w=v.lookup!=null?Ce(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,$=this.parseAndCache(w,t);$==null&&v.default!=null&&($=this.parseAndCache(v.default,t));for(let N=0;N<$.length;N++)x($[N],_,C.placeholder,T);l=O,h=P,R=C}else if(f.type===qn){let v,O=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let M=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let D=M.children[0].bindings;for(let V in D)I[V]=D[V];C.push(...M.children[0].children)}else if(O.namespace!=null&&this.namespaceHandlers[O.namespace])v=this.namespaceHandlers[O.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in O.atts)if(O.atts.hasOwnProperty(N)){let M=O.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:M,type:lA};for(let V=0;V<D.expressions.length;V++){let J=D.expressions[V],ye=wi(J.expression,j=>j===Sl?T:j===bo?b:this.lookupValueInDataOrContext(b,n,j),j=>this.Si(j,b,n),J.format,this.formatter);M=M.replace(J.source,ye),I[N].results.push({source:J.source,result:ye})}}this.setAttribute(v,N,M)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let _=l,w=h,$=p(v,O,I,A);$.children.push(...C),h=$,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=_,R=$}else if(f.type===Li){let v=f.value||"",O={},P=f.compiledBindings[Ni.TEXT_BINDING_NAME];if(P!=null){O[Ni.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Li};for(let _=0;_<P.expressions.length;_++){let w=P.expressions[_],$=wi(w.expression,N=>N===Sl?T:N===bo?b:this.lookupValueInDataOrContext(b,n,N),N=>this.Si(N,b,n),w.format,this.formatter);v=v.replace(w.source,$),O[Ni.TEXT_BINDING_NAME].results.push({source:w.source,result:$})}}let I=this.ctn(v);R=g(I,f,O,A)}return R};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function KN(i){return ei.exists(i)}function qN(i,r,e,t,n,o){return ei.construct(r,e,i,t,n,o)}function v_(i,r,e,t,n){n=n||[],e=i._d(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},g=(E,y,x,f)=>{let b=uA(E,i);return KN(b.el)?qN(i,b.el,b,x,o,n):new Fr(b,i,x,o,n)},m=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new Gs(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==Ao.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Ni({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Gm(Ni.TEXT_BINDING_NAME,E,A,null,f)}}];if(bx(St(r).split(i.tokenizerRe),(E,y)=>{let x=St(y);for(let f=0;f<m.length;f++){let b=a(x,m[f].re);if(b){m[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function EA(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var Ld=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},Hm=class extends Ld{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},km=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},Wm=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var Zm=class extends So{Pd(){return null}ce(r){return new Hm(r)}cf(){return new Ld}ctn(r){return new km(r)}cc(r){return new Wm(r)}removeElement(r){}removeTextNode(r){}};function wd(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function Jm(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function fA(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Dd(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let g=u.edge.pathDirection,m=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=g===1?E+1:E-1,f=m===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=g===1?E-1:E+1,S=m===1?y-1:y+1,R=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,O=l.axis===0?Q:Ee,P=b?b.midpoint[O]:R?R.midpoint[O]:p.edge.sourceCenter[O]!==u.edge.sourceCenter[O]?u.edge.sourceCenter[O]:u.edge.targetCenter[O],I=b?A.midpoint[O]:v?v.midpoint[O]:u.edge.sourceCenter[O]!==p.edge.sourceCenter[O]?p.edge.sourceCenter[O]:p.edge.targetCenter[O];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function Nd(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,g=s.axis===0?l===1?u.height:0:l===1?u.width:0,m=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+m,[x]:p},b={[y]:d.location+E,[x]:g};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var Id="separate",QN="bus";function yA(i){let r=i.axis,e=i.gates,t=i.gateMap||wd(e),n=i.mode||Id,o=i.regions,s=i.edges,a=i.pad||10,l={};Dd(s,e,t,i.getVertexPosition,i.getVertexSize),Nd(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if(fA(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=Jm(f,r),T=Jm(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,g=r===0?o[h].left:o[h].top,m=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===Id)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let g=p.edgeMap[d.id];l[d.id].push(...g)})}return l}function xA(i){let r=i.gates,e=wd(r),t=i.regions,n=i.edges,o={};Dd(n,r,e,i.getVertexPosition,i.getVertexSize),Nd(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var bA=4;function C_(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var $s={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=C_(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=C_(s),$s.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),$s.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function P_(i){return i.height*i.width}function Km(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function qm(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&qm(i.parent)}function AA(i,r){return i.x===1/0?P_(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-P_(i)}function Qm(i){let r=Math.floor(i.children.length/2),e=To(),t=To();return $s.sortRect(i.children).forEach((n,o)=>{o<=r?vo(e,n):vo(t,n)}),i.children.length=0,[e,t]}function To(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Md(i){return i.children==null||i.children.length===0}function SA(i){return Md(i)||Md(i.children[0])}function vo(i,r){r.parent=i,i.children.push(r),Km(i,r)}function eE(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function O_(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(O_(e)):r.concat(e)},[])}function TA(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function __(i){i.parent&&(eE(i.parent,i),qm(i.parent))}var Bs=class{constructor(r){c(this,"Wt");c(this,"ee");c(this,"Br",{});this.Wt=r||bA,this.ee=To()}search(r,e){let t=[];return this.Rd(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.Rd(r,(n,o)=>t.push({node:n,overlap:Ig(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}Rd(r,e,t){if(this.ee.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(Je(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(Je(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&Ig(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.ee)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{ux(r,o)&&(Md(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.ee),t}insert(r){let e=n=>{let o=this.ee;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.Br[n.id]=s);!SA(o);)Km(o,s),o=TA(o.children,a=>AA(a,s));vo(o,s),this.pE(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}pE(r){let e=r;for(;e.parent&&e.parent.children.length>this.Wt;)e=e.parent,e!=this.ee?(eE(e.parent,e),Qm(e).forEach(t=>{vo(e.parent,t)})):e==this.ee&&Qm(e).forEach(t=>{vo(e,t)})}Ld(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.Wt),n=[],o=0,s;for(let a=0;a<t;a++){s=To(),o=Math.min(this.Wt,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.Br[h.id]=h),vo(s,h)}n.push(s)}return t>1?this.Ld(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=$s.sortRect(r);this.ee=this.Ld(e)[0]||To()}}getBounds(){return{x:this.ee.x,y:this.ee.y,width:this.ee.width,height:this.ee.height}}getExtents(){return{xmin:this.ee.x,ymin:this.ee.y,xmax:this.ee.x+this.ee.width,ymax:this.ee.y+this.ee.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.wd(e),e}wd(r,e){let t=[],n=r.parent;for(__(r),r.id!=null&&delete this.Br[r.id];n!=null&&n!==this.ee;)n.children.length<=this.Wt/2&&(__(n),t.push(...this.mE(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.Br[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.wd(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.ee=To(),this.Br={}}getLeafNodes(){return Object.values(this.Br)}has(r){return this.Br.hasOwnProperty(r)}mE(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Vd=class i{constructor(r){this.instance=r;c(this,"ae",[]);c(this,"K",[]);c(this,"q",[])}static from(r){let e=new i(r.instance);return e.ae=r.ae.slice(),e.K=r.K.slice(),e.q=r.q.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.gE(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,wx,null))}),s}gE(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(m){let E=r.getCoordinates(m,!0);u.set(m.id,E),m.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.K.forEach(p),this.ae.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let g=(m,E,y)=>{y=y||0;let x=Object.assign({},m.data),f=G();if(o.vertexMap.set(m.getFullId(),f),x.id=f,E==null){let b=u.get(m.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x.group!=null&&delete x.group}else x.group=E.id;return!n&&z(m)&&m.getMembers().forEach(b=>{let A=g(b,x,y+1);z(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.ae.forEach(m=>o.nodes.push(g(m,null,0)[0])),this.K.forEach(m=>s.push(g(m,null,0))),s.sort((m,E)=>m[1]<E[1]?-1:1),o.groups=s.map(m=>m[0]),this.q.forEach(m=>{let E,y,x=m.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=m.target,T=H(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let R={source:E,target:y,data:Object.assign({},m.data||{})};if(R.data.id!=null){let v=G();o.edgeMap.set(R.data.id,v),R.data.id=v}m.geometry!=null&&S!=null&&b!=null&&(R.geometry=r.transformGeometry(m,o.transform.x,o.transform.y)),o.edges.push(R)}),o}};var Gd=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Vd.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var tE="Anchor",vt="top",Ct="left",Pt="right",Ot="bottom",rE={[vt]:{x:0,y:-1},[Ot]:{x:0,y:1},[Pt]:{x:1,y:0},[Ct]:{x:-1,y:0}},eI=[Ct,Pt],tI=[vt,Ot],rI={[vt]:[Ct,Pt],[Ot]:[Ct,Pt],[Ct]:[Ot,vt],[Pt]:[Ot,vt]},nI={[vt]:Ot,[Ot]:vt,[Ct]:Pt,[Pt]:Ct},R_=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(R_||{}),vl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(vl||{});var Sn={};function Fs(i,r){Sn[i]=r}var cr={lineIntersection(i,r,e,t,n){return Sn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return Sn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return Sn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return Sn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return Sn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return Sn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return Sn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return Sn[i.type].getPath(i,r)}};function nE(i){return Sn[i.type].getLength(i)}function vA(i,r){return Sn[i].create(r)}function iI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function CA(i,r,e){return iI()}function PA(i,r,e,t,n){return[]}function Cl(i,r,e,t,n){let o=[];return o.push.apply(o,cr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,cr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,cr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,cr.lineIntersection(i,r,e+n,r,e)),o}function OA(i,r){return Cl(i,r.x,r.y,r.width,r.height)}function Us(i){return Object.assign({extents:xi()},i)}function L_(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:Q,stubs:[0,0]}}function zs(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function $d(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:xi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:L_()}}function iE(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var _A=.45,w_=62;function Bd(i,r,e){let t=$d(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||w_,isLoopbackCurrently:!1,constrain:Jr,smooth:!0})}var ti={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},D_=64,oI=Math.pow(2,-D_-1);function M_(i,r){let e=[],t=sI(i,r),n=r.length-1,o=2*n-1,s=RA(t,o,e,0),a=ti.subtract(i,r[0]),l=ti.square(a),h=0,d;for(let u=0;u<s;u++)a=ti.subtract(i,LA(r,n,e[u],null,null)),d=ti.square(a),d<l&&(l=d,h=e[u]);return a=ti.subtract(i,r[n]),d=ti.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function NA(i,r){let e=M_(i,r);return{point:LA(r,r.length-1,e.location,null,null),location:e.location}}function sI(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=ti.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=ti.subtract(r[u+1],r[u]),o[u]=ti.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=ti.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),g=Math.min(u,h);for(let m=p;m<=g;m++){let E=u-m;a[m+E].y+=s[E][m]*l[E][m]}}return a}function RA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(aI(i,r)){case 0:return 0;case 1:{if(t>=D_)return e[0]=(i[0].x+i[r].x)/2,1;if(lI(i,r))return e[0]=hI(i,r),1;break}}LA(i,r,.5,n,o),s=RA(n,r,l,t+1),a=RA(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function aI(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function lI(i,r){let e,t,n,o,s,a,l,h,d,u,p,g,m,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,g=1,m=0,E=a,y=l,x=h-f,d=p*y-E*g,u=1/d,t=(g*x-y*m)*u,E=a,y=l,x=h-b,d=p*y-E*g,u=1/d,n=(g*x-y*m)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<oI?1:0}function hI(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function LA(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function cI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(dI(t/i,r));return e}function dI(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function IA(i){let r=0;if(!DA(i)){let t=cI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=wA(o,s)}}return r}var N_=new Map;function uI(i){let r=N_.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),N_.set(i,r)}return r}function Ys(i,r){let e=uI(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function wA(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function DA(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function Fd(i,r,e){if(DA(i))return{point:i[0],location:r};let t=Ys(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=Ys(i,o),n+=wA(a,t),t=a;return{point:a,location:o}}function MA(i,r,e){return Fd(i,r,e).point}function VA(i,r,e){return Fd(i,r,e).location}function Ud(i,r){let e=Ys(i,r),t=Ys(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function pI(i,r,e){let t=Fd(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Ud(i,t.location)}function gI(i,r,e,t){t=t==null?0:t;let n=Fd(i,r,t),o=Ud(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function Tn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=fI(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=yI.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let g=d[p],m=Math.pow(g,2),E=Math.pow(g,3),y={x:l[0][0]*E+l[0][1]*m+l[0][2]*g+l[0][3],y:l[1][0]*E+l[1][1]*m+l[1][2]*g+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),g>=0&&g<=1&&x>=0&&x<=1&&u.push(y)}return u}function mI(i,r,e,t,n){let o=[];return o.push.apply(o,Tn(i,r,i+e,r,n)),o.push.apply(o,Tn(i+e,r,i+e,r+t,n)),o.push.apply(o,Tn(i+e,r+t,i,r+t,n)),o.push.apply(o,Tn(i,r+t,i,r,n)),o}function EI(i,r){let e=[];return e.push.apply(e,Tn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Tn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Tn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Tn(i.x,i.y+i.height,i.x,i.y,r)),e}function I_(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function fI(i){return[I_(i,"x"),I_(i,"y")]}function yI(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let g=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(g/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((g+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((g+4*Math.PI)/3)-n/3}for(let g=0;g<3;g++)(p[g]<0||p[g]>1)&&(p[g]=-1);return p}var Co="Bezier";function GA(i,r,e){return e&&(r=VA(i,r>0?0:1,r)),r}var V_={create(i){let r=Us(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:Co})},boundingBoxIntersection(i,r){return OA(i,r)},boxIntersection(i,r,e,t,n){return Cl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=NA({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=IA(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=GA(i.curve,r,e),Ud(i.curve,r)},lineIntersection(i,r,e,t,n){return Tn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=GA(i.curve,r,t),MA(i.curve,r,e)},pointOnPath(i,r,e){return r=GA(i.curve,r,e),Ys(i.curve,r)}};Fs(Co,V_);var zd={};function xI(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function G_(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function bI(i){return!i.source||!i.target||!G_(i.source)||!G_(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!xI(r))==null}var Ur=i=>lt(i.geometry),Ve={get:(i,r,e)=>{let t=zd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{zd[i]=r},compute:(i,r,e)=>{let t=zd[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=zd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},markEdited(i,r){r=r||Ur(i.connector),i.connector.edited=!0,i.edge.geometry=r,Ve.$_setAnchorsFromGeometry(i,r)},importGeometry(i,r){if(bI(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,Ve.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){iE(r.source,i,0),iE(r.target,i,1)},transformGeometry(i,r,e,t){let n=zd[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=Ur(t))}}};function AI(i){return i.geometry}function SI(i,r){return i.geometry=r,!0}function B_(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function sE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function zr(i,r,e){if(e.x1===e.x2&&e.y1===e.y2)return;let t=vA(r,e);i.internalSegments.push(t),i.totalLength+=nE(t),B_(i,t)}function oE(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function dr(i,r,e){let t=oE(i,r,e);return t.segment&&cr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function TI(i,r,e){let t=oE(i,r,e);return t.segment&&cr.gradientAtPoint(t.segment,t.proportion,!1)||0}function Ye(i,r,e,t){let n=oE(i,r,t);return n.segment&&cr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function aE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=nE(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function $_(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function lE(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),g=Math.abs(o-n),m=!$_(r.sourcePos),E=!$_(r.targetPos);if(m||E){let S=p>g,R=S?e:n,v=S?t:o,O=R>v?-1:1,P=R>v?1:-1;m&&(l.x=S?O:0,l.y=S?0:O),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:g,quadrant:us({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?Ee:Q,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function vI(i,r){let e=i.connector;e.paintInfo=lE(e,r),sE(e),Ve.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,aE(e)}function Ii(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function $A(i){i.bounds=xi()}function BA(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=cr.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function CI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,cr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function PI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,cr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function FA(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,cr.boundingBoxIntersection(i.internalSegments[t],r));return e}function OI(i){return i.typeDescriptor==="connector"}function UA(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=cr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function _I(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,g,m;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;g={x:E,y},m={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;g={x:r.sx+x,y:r.sy+f},m={x:r.tx+b,y:r.ty+A}}return[g,m]}function RI(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=_I(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function F_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function LI(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,g=(l+d)/2,m=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=wI(p,g,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,m,i.proximityLimit),[u,u]}function wI(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function U_(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Yd(i,r,e,t,n){let o=i.connector,s,a;o.type===Po?[s,a]=U_(o):[s,a]=F_(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return zr(o,Co,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Xd(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===Po?t.edited?[l,h]=U_(t):[l,h]=RI(t,r,e,n,o,s,a):t.edited?[l,h]=F_(t):[l,h]=LI(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return zr(t,Co,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function jd(i,r,e){return{source:zs(i.source,r,e),target:zs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var Po="Bezier";function z_(i,r){let e=Bd(Po,i,r);return Object.assign(e,{scale:r.scale||_A})}Ve.register(Po,{compute:Xd,update:Yd,create:z_,transformGeometry:jd});var Hd="QuadraticBezier";function Y_(i,r){let e=Bd(Hd,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",zb:{x:0,y:0}})}Ve.register(Hd,{compute:Xd,update:Yd,create:Y_,transformGeometry:jd});var hE="perpendicular",cE="orthogonal",dE="opposite",Xs="Orthogonal",zA="Smooth",YA=30;function Pl(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function XA(i,r,e){return kd(r,"h",e,1)}function jA(i,r,e){return kd(r,"h",e,-1)}function HA(i,r,e){return kd(r,"v",e,1)}function kA(i,r,e){return kd(r,"v",e,-1)}function kd(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function Wd(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function Zd(i,r,e,t){let n=i.indexOf(t),o=Wd(i,r,e,t);return o&&o[1]==n+r?o:null}function Oo(i){return{[re]:Math.sign(i.x2-i.x1),[ue]:Math.sign(i.y2-i.y1)}}function uE(i,r){return i.curX===r.curX&&i.curY===r.curY}function Ol(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?ue:re;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function WA(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===re){if(Pl(t.x2,i[0].x1,i[0].x2)||nr(o,r).length>0){let a=HA(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:ue}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:ue}),a.segment.y1=h}}}}else if(t.o===ue&&(Pl(t.y2,i[0].y1,i[0].y2)||nr(o,r).length>0)){let a=XA(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:re}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:re}),a.segment.x1=h}}}return n}function ZA(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===re){if(Pl(n.x1,a.x1,a.x2)||nr(s,r).length>0){let h=kA(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:ue}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:ue}),h.segment.y2=u}}}}else if(n.o===ue&&(Pl(n.y1,a.y1,a.y2)||nr(s,r).length>0)){let h=jA(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:re}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:re}),h.segment.x2=u}}}return o}function JA(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=ZA(r,t,i.targetStub),s=WA(r,e,i.sourceStub)):(s=WA(r,e,i.sourceStub),o=ZA(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var vn="Straight";function ri(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function pE(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function gE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var _o={create(i){let r=Us(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Dr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:vn})},boundingBoxIntersection(i,r){return _o.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,_o.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,_o.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,_o.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,_o.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=pE(i.x1,i.x2,r)?r:gE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=pE(i.y1,i.y2,e)?e:gE(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=pE(i.x1,i.x2,a)?a:gE(i.x1,i.x2,a),t.y=pE(i.y1,i.y2,l)?l:gE(i.y1,i.y2,l)}let n=$e({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=$e({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Dr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)ri(r,i.x1,i.x2)&&ri(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)ri(e,i.y1,i.y2)&&ri(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,ri(d,i.x1,i.x2)&&(u=s*r+a,ri(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,ri(u,i.y1,i.y2)&&(d=(e-a)/s,ri(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,ri(d,i.x1,i.x2)&&ri(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=_o.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),zt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return zt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};Fs(vn,_o);var X_=1e-10;function j_(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<X_?r:e-i<X_?e:i}var _l="Arc";function H_(i,r,e,t){return Za({x:i,y:r},{x:e,y:t})}function DI(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+fi:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+fi:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var Jd={create(i){let r=Us(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=H_(e,t,r.x1,r.y1),a=H_(e,t,r.x2,r.y2)),a<0&&(a+=fi),s<0&&(s+=fi);let l=a<s?a+fi:a,h=Math.abs(l-s);o&&(h=fi-h);let d=2*Math.PI*n,u=h/fi,p=d*u,g={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:g,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:_l})},boundingBoxIntersection(i,r){return Jd.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Cl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return CA(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=Jd.pointOnPath(i,r,e),n=dx({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return PA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=Jd.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=DI(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:j_(n),y:j_(o),theta:t}}};Fs(_l,Jd);var k_={x:[Q,Ee],y:[Ee,Q]};function W_(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var Rl=new Map;Rl.set(hE,W_),Rl.set(cE,W_),Rl.set(dE,(i,r)=>{let e=i,t=e.sourceAxis,n={[Q]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[Ee]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[Q]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[Ee]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var Ll=new Map;Ll.set(hE,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},g={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},m={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=k_[e][0],f=k_[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],R=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&R<S)return g[e];if(i.quadrant===v[2]&&R>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return m[e]}),Ll.set(cE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[Ee]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[Q]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[Ee]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Ll.set(dE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:Ee,[Ee]:Q}[e],u=e===Q?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[Q]:De,[Ee]:ve}[e],g=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[Q]:[{x:t,y:g},{x:o,y:g}],[Ee]:[{x:g,y:t},{x:g,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[Q]:[{x:t,y:l},{x:o,y:l}],[Ee]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[Q]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[Ee]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function KA(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=Rl.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===Q?0:1,l=r.sourceAxis===Q?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];Ol(t,s[0],s[1],r,n,o);let g=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,m=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Ll.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,g,m,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)Ol(t,y[x].x,y[x].y,r,n,o);return Ol(t,s[2],s[3],r,n,o),Ol(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function Kd(i,r){let e=r;return i.smooth===!0&&e.length>=2?MI(i,e).map(n=>zr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?NI(i,e):e.map(t=>zr(i,vn,t)),i.$pathSegments=e,e}function qA(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function QA(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function NI(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=qA(e),o=qA(t),i.cornerRadius>0&&n!==o){let a=Math.min(QA(e),QA(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=Qt({x:e.x1,y:e.y1},h,1e4),g=Qt({x:t.x1,y:t.y1},d,1e4),m=Mg(p,g),E=m!=null?$e(m,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,zr(i,vn,Object.assign({},e)),i.slightlyWonky?zr(i,_l,Object.assign({r:l,cx:m.x,cy:m.y,ac:u>0},e)):zr(i,_l,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:m.x,cy:m.y,ac:u>0})):zr(i,vn,Object.assign({},e))}else zr(i,vn,Object.assign({},e));e=t}t!=null&&zr(i,vn,Object.assign({},e))}var II=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},Z_=(i,r,e,t,n)=>{let a=II(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function mE(i,r){let e=[];for(let t=1;t<i.length;t++){let n=Z_(i[t-1],i[t-2],i[t],r),o=Z_(i[t],i[t-1],i[t+1],r,!0);e.push({type:Co,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function MI(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),mE(e,i.smoothing)}function J_(i,r,e){return EE([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function qd(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===Kr?eS(s,a,o,r,e,t,n):VI(s,a,o,r.quadrant,t,n),Kd(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function Qd(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===Kr?t.$pathSegments=KA(t,r,e):t.$pathSegments=J_(t,r,e),Kd(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function VI(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function eu(i,r,e){return{source:zs(i.source,r,e),target:zs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function EE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var K_=.15,Cn="Straight";function js(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}Ve.register(Cn,{compute:Qd,update:qd,create:tS,transformGeometry:eu});function GI(i,r){let e=Object.assign(r,{constrain:Kr});return tS(i,e)}Ve.register(Xs,{compute:Qd,update:qd,create:GI,transformGeometry:eu});function $I(i,r){let e=Object.assign(r,{constrain:Jr,smooth:!0});return tS(i,e)}Ve.register(zA,{compute:Qd,update:qd,create:$I,transformGeometry:eu});function BI(i){return i==null?null:i===Mx?Kr:i===Vx?_c:i}function tS(i,r){let e=BI(r.constrain);r.stub=r.stub==null?e===Kr?YA:null:r.stub;let t=$d(Cn,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?K_:r.smoothing,geometry:{segments:[]},constrain:e==null?Jr:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function nS(i,r,e){rS(1,i,r,e),rS(0,i,r,e)}var Ro="x2",Lo="x1",wo="y1",Do="y2";function FI(i,r,e){let t=e===i.x1?{value:i.x2,coord:Ro,prev:!0}:{value:i.x1,coord:Lo,prev:!0},n=e===r.x1?{value:r.x2,coord:Ro,prev:!1}:{value:r.x1,coord:Lo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function UI(i,r,e){let t=e===i.y1?{value:i.y2,coord:Do,prev:!0}:{value:i.y1,coord:wo,prev:!0},n=e===r.y1?{value:r.y2,coord:Do,prev:!1}:{value:r.y1,coord:wo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function q_(i,r){if(r.length<5)return r;function e(d,u,p){let g=p===d.x1?d.x2:d.x1,m=p===u.x1?u.x2:u.x1;if(g>u.x1&&u.x2>g||g>u.x2&&u.x1>g)return g;if(m>d.x1&&d.x2>m||m>d.x2&&d.x1>m)return m}function t(d,u,p){let g=p===d.y1?d.y2:d.y1,m=p===u.y1?u.y2:u.y1;if(g>u.y1&&u.y2>g||g>u.y2&&u.y1>g)return g;if(m>d.y1&&d.y2>m||m>d.y2&&d.y1>m)return m}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Oo(n)[n.o],o.o!==n.o)if(js(o)<a){let p=r[d+1];if(Oo(p)[p.o]!==s){let m=Object.assign({},o);if(o.o===ue){let E=FI(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(m.x1=y,m.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}else if(o.o===re){let E=UI(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(m.y1=y,m.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?fE(h):h}function rS(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?Ro:Lo,p=i===1?Do:wo,g=i===1?Lo:Ro,m=i===1?wo:Do,E=1,y=n.length-2,x=1,f=n[1];o[g]=l+a*d.x,o[m]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Oo(o),A=o.o,T=o.o===re?ue:re,S=o.o===re?[Ro,Lo]:[Do,wo],R=o.o===re?[Lo,Ro]:[wo,Do],v=o.o===re?[Do,wo]:[Ro,Lo],O=o.o===re?[wo,Do]:[Lo,Ro],P=S[i],I=R[i],C=v[i],_=O[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[_]=o[C];let $=Oo(f)[A],N=Zd(n,x,T,f);if($!==b[A]){if(N!=null){let M=Zd(n,x,A,N[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][_]=o[C];else{let D=(N[0][C]+N[0][_])/2;N[0][_]=D,f[C]=f[_]=D;let V={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,V)}}}else if(f[C]=f[_]=o[C],N!=null)N[0][_]=o[C];else if(f[C]!==s[_]){let M={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[_]:f[_]},D=n.length-1;n.splice(D,0,M)}}else{f[_]=o[C],f[P]=f[I]=o[P];let $=Zd(n,x,A,f);if($!=null){let N=Oo($[0])[A];$[0][I]=o[P];let M=Oo($[0])[A];if(N!==M&&$[1]===y){n.splice($[1],1);let D=(f[C]+f[_])/2;f[_]=D,f[P]=f[I]=s[I];let V={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[_]:D,[I]:o[P]};n.splice(E,0,V);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[_]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let N=(f[C]+f[_])/2;f[_]=N,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[_]:N,[I]:o[P]};n.splice(E,0,M);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[_]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=q_(r,n);i===1&&w.reverse(),r.$pathSegments=w}function eS(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(g=>{let m=Object.assign({},g);m.x1+=l,m.x2+=l,m.y1+=h,m.y2+=h,p.push(m)}),e.$pathSegments=p;return}nS(e,t,n)}}function zI(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?Wd(i,-1,n,o):null,right:e?Wd(i,1,n,o):null}}else return null}function iS(i,r,e,t,n){let o=zI(r.$pathSegments,e);if(o!=null){o.axis===ue?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===ue,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let g={o:re,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}else if(d.y1!==r.$pathSegments[0].y2){let g={o:ue,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let g={o:re,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}else if(d.y2!==p.y1){let g={o:ue,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}if(n!==!0){let g=i.instance.getElement(i.sourceId),m=i.instance.getElement(i.targetId);JA(r,r.$pathSegments,g,m,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function fE(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>js(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===re?ue:re,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===re?ue:re,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function oS(i){let r=fE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var tu=class extends Vt{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire(gl,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(gl,{key:e,value:t})}};var Mi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Mi||{});var Pn="px",On="50px",Cr="block",pt="none",st="absolute",yE="fixed",sS="static",aS="relative",YI="data-vjs-group",_t="data-vjs-managed",wl="data-vjs-not-draggable",lS="data-vjs-elements-draggable",xE="tabindex",ee="data-vjs-vertex",en="data-vjs-port",Dl="data-vjs-port-id",Yr="data-vjs-port-type",ru="data-vjs-edge-type",hS="data-vjs-source",No="data-vjs-target",bE="data-vjs-allow-loopback",AE="data-vjs-source-port-id",nu="data-vjs-target-port-id",Hs="data-vjs-source-port",Io="data-vjs-target-port",Vi="data-vjs-source-port-type",Gi="data-vjs-target-port-type",iu="data-vjs-magnet",qe="data-vjs-edge",ou="data-vjs-overlay-id",ur="*";var ks="vjs-connector",cS="vjs-connector-path",dS="vjs-connector-outline",uS="vjs-connector-transient",Nl="vjs-connected",SE="vjs-group-collapsed",TE="vjs-group-expanded",su="vjs-toggle-group-collapse",Ws="vjs-overlay",Il="vjs-overlay-hide",pS="vjs-label-overlay",$i="vjs-node",gS="vjs-port",Mo="vjs-group",mS="vjs-dummy-vertex",Ml="vjs-selected-connection",Bi="vjs-selected-element",Zs="vjs-edge-delete",au="vjs-edge-delete-i";var vE="allowNestedGroups",Vl="anchor",Gl="anchors",ES="astarVertexBorder",fS="astarVertexBuffer",XI="edgesDetachable",lu="connector",yS="cssClass",xS="edgeRelocateHandleSize",jI="groupSize",bS="hoverClass",hu="hoverPaintStyle",AS="maxConnections",HI="nodeSize",Vo="paintStyle",kI="reattachEdges",CE="scope",SS=[.05,3];function TS(i){return i.type!=null&&i.options!=null}function ii(i){let r=null;return X(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||G(),r}var cu="always",Fi="hover";function PE(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var ni=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"Qo");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||G(),this.cssClass=e.cssClass||"",PE(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.Qo=r.instance.$isTouchDevice()?cu:e.visibility||cu,this.Qo===Fi&&(this.visible=!1)}},_n=class extends ni{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var Q_={},at={get:(i,r,e,t)=>{let n=Q_[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{Q_[i]=r}};var OE=class OE extends ni{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",OE.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return un(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&PE(this,e.location),_E(this,t)}};c(OE,"type","Label");var pr=OE;function Xr(i){return i.type===pr.type}at.register(pr.type,pr);function _E(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var RE="labelLocation",WI=[Vl,Gl,"cssClass",lu,Vo,hu],ZI="parent";function du(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[ZI],p;if(Array.isArray(u)?p=u:p=[u],p.find(m=>d.indexOf(m)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(m=>e(m)).filter(m=>m!=null)}},n=(h,d,u)=>{let p=WI.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let g=pn(h,d,[],p);return o(t(h,u),g,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let g=0;g<h.length;g++)p=n(h[g],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function Js(i){return(r,e,t)=>{let n=xc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function vS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=Js(i.anchorPositions))}var uu=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if(TS(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=du([r,xe],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:pr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||RE;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||Zs)+" "+au,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:pr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===Fi?Fi:cu}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=du([r,xe],this.nodes);return delete e.parent,vS(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=du([r,xe],this.ports);return delete e.parent,vS(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=du([r,xe],this.groups);return delete e.parent,vS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(z(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function pu(){return new Set}var eR=class{constructor(){c(this,"affectedElements",new Set)}};function rR(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function JI(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>He({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),g=d(r+t,e+n),m=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,g.x,m.x),x=Math.max(u.x,p.x,g.x,m.x),f=Math.min(u.y,p.y,g.y,m.y),b=Math.max(u.y,p.y,g.y,m.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var LE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},tR=(i,r)=>LE(i,r)*-1;function wE(i,r,e,t,n){Fg({id:i,value:r,otherBound:e},t,LE,n)}function Go(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var gu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"Dd",null);c(this,"rtree");c(this,"Ye",!1);c(this,"$a",!0);c(this,"O",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"N",{});c(this,"Ba",{});c(this,"Xe",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Bs(4)}setSuspended(r){this.Ye=r,this.Ye||(this.recomputeBounds(),this.EE())}getExtents(){return Object.assign({},this.Xe)}fE(r,e,t){e!=null&&(Go(r,this.O.xmin),Go(r,this.O.xmax),Go(r,this.O.ymin),Go(r,this.O.ymax),wE(r,e.t.x,e.t.x2,this.O.xmin,!1),wE(r,e.t.x2,e.t.x,this.O.xmax,!0),wE(r,e.t.y,e.t.y2,this.O.ymin,!1),wE(r,e.t.y2,e.t.y,this.O.ymax,!0),t!==!0&&this.es())}es(){this.Xe.xmin=this.O.xmin.length>0?this.O.xmin[0].value:0,this.Xe.xmax=this.O.xmax.length>0?this.O.xmax[0].value:0,this.Xe.ymin=this.O.ymin.length>0?this.O.ymin[0].value:0,this.Xe.ymax=this.O.ymax.length>0?this.O.ymax[0].value:0}recomputeBounds(){if(this.$a){this.$a=!1,this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0;for(let r in this.N){let e=this.N[r];this.O.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.O.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.O.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.O.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.O.xmin.sort(LE),this.O.ymin.sort(LE),this.O.xmax.sort(tR),this.O.ymax.sort(tR),this.es()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.O.xmin.length;a++){let l=this.O.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.N[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.N[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.O.xmin.length;a++){let l=this.O.xmin[a];if(n.indexOf(l.id)===-1&&Vg(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.N[l.id];if(Vg(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.N[d]),t))return s}}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=mx(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}yE(r,e,t){e.t=JI(r,e.x,e.y,e.width,e.height,e.r),this.Ba[r]=e.t,this.$a=!0,t!==!0&&(this.Ye||this.fE(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Ye||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=Es(this.N,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=He({x:h.x,y:h.y},h.c,h.r),this.Dd==null?this.yE(r,h,l):this.Dd.affectedElements.add(r)),h}$forEachElement(r){for(let e in this.N)r(this.N[e])}$refreshEveryElement(){for(let r in this.N)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.N[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==he.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}xE(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.Xe.xmax-this.Xe.xmin}getBoundsHeight(){return this.Xe.ymax-this.Xe.ymin}getX(){return this.Xe.xmin}getY(){return this.Xe.ymin}setSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.N[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.N[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.O.xmin.length=0,this.O.xmax.length=0,this.O.ymin.length=0,this.O.ymax.length=0,this.N={},this.Ba={},this.rtree.clear(),this.es()}remove(r){Go(r,this.O.xmin),Go(r,this.O.xmax),Go(r,this.O.ymin),Go(r,this.O.ymax),delete this.N[r],delete this.Ba[r],this.rtree!=null&&this.rtree.removeById(r),this.es()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,g,m,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((g=u.t)==null?void 0:g.x)||u.x,T=((m=n[u.id])==null?void 0:m.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,R=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+R)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}EE(){this.rtree.clear();let r=Object.values(this.N).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.N[r]}getElements(){return this.N}isEmpty(){return Object.keys(this.N).length===0}getElement(r){return this.N[r]}getElementPosition(r){return this.N[r]!=null?Dt(this.N[r]):null}getElementSize(r){return this.N[r]!=null?Xn(this.N[r]):null}getElementBounds(r){return this.N[r]!=null?Object.assign(Dt(this.N[r]),Xn(this.N[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=rR(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.N[r]=l,z(t)){let g=a;g.collapsed=!1,g.enabled=!0,g.contentArea=this.instance.$getGroupContentAreaElement(e),g.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(g.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var KI="currentFace",nR={[vt]:Ot,[Pt]:Ct,[Ct]:Pt,[Ot]:vt},iR={[vt]:Pt,[Pt]:Ot,[Ct]:vt,[Ot]:Ct},oR={[vt]:Ct,[Pt]:vt,[Ct]:Ot,[Ot]:Pt};function $l(i,r){return i.faces.indexOf(r)!==-1}function qI(i,r){return(i.clockwise?iR:oR)[r]}function QI(i,r){return(i.clockwise?oR:iR)[r]}function DE(i,r,e){let t=()=>$l(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function eM(i,r){if($l(i,r))return r;if($l(i,nR[r]))return nR[r];{let e=qI(i,r);if($l(i,e))return e;{let t=QI(i,r);if($l(i,t))return t}}return r}function CS(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:G(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,Nd:null};return Object.defineProperty(t,KI,{get(){return this.Nd},set(n){this.Nd=eM(this,n)}}),t}var PS={Continuous:{faces:[vt,Ct,Ot,Pt]},ContinuousTop:{faces:[vt]},ContinuousRight:{faces:[Pt]},ContinuousBottom:{faces:[Ot]},ContinuousLeft:{faces:[Ct]},ContinuousLeftRight:{faces:[Ct,Pt]},ContinuousTopBottom:{faces:[vt,Ot]}};function tM(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var sR={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},aR={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},lR={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},hR={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},rM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},nM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},iM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},oM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},sM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},cR={Top:[sR],Bottom:[aR],Left:[lR],Right:[hR],TopLeft:[rM],TopRight:[nM],BottomLeft:[iM],BottomRight:[oM],Center:[sM],AutoDefault:[sR,lR,aR,hR]};function dR(i,r){r=r||{};let e=cR[i];if(e!=null)return NE(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=PS[i];if(t!=null)return CS(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function NE(i,r,e,t){return{objectType:tE,type:i,locations:r,currentLocation:0,id:G(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function uR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function mu(i,r,e){let t=bt(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&tM(t,e),t}function aM(i){return i.objectType===tE}function bt(i,r){if(aM(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),X(i)){let e=dR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(uR(i))return NE(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(X(t)){let n=cR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(uR(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return NE("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return dR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var lM="___sourceMarker",hM="___targetMarker",fu="__label",LS="vjs-default-label",OS="overlay",gR="labelLocation";function cM(i,r){let e=null;if(X(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||G(),Le.cacheTypeItem(i,OS,e,e.id),i.overlays[e.id]=e,e}function Bl(i,r){let e=cM(i,r);if(e.type===pr.type&&!X(r)){let t=e,o=r.options.labelLocationAttribute||gR,s=i.edge.data[o];s&&(t.location=s),_E(t,i.edge.data)}return e}function ME(i,r){return i.overlays[r]}function mR(i){return i.overlays}function ER(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function fR(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function $o(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function dM(i){return ME(i,fu)}var _S="add",RS="remove",Eu="anchors",IE="connector";function pR(i,r,e){for(let t in i.overlays)r===_S?i.instance.$addOverlayClass(i.overlays[t],e):r===RS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function wS(i,r,e){let t=null;r.connector!=null&&(t=Le.getCachedTypeItem(i,IE,e.connector),t==null&&(t=Wt.Id(i,r.connector,e.connector),Le.cacheTypeItem(i,IE,t,e.connector)),Wt.setPreparedConnector(i,t)),Le.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=Le.getCachedTypeItem(i,OS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.Qo!==Fi&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Bl(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&$o(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=Le.getCachedTypeItem(i,Eu,e.anchor),s==null&&(s=[bt(r.anchor),bt(r.anchor)],Le.cacheTypeItem(i,Eu,s,e.anchor))):r.anchors&&(s=Le.getCachedTypeItem(i,Eu,e.anchors),s==null&&(s=[bt(r.anchors[0]),bt(r.anchors[1])],Le.cacheTypeItem(i,Eu,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function jr(i,r){Le.addClass(i,r),pR(i,_S,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Pr(i,r){Le.removeClass(i,r),pR(i,RS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var Wt={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&Le.cacheTypeItem(i,IE,r,n),jr(i,s),o!=null){let a=mR(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,Le.destroy(i)},setVisible(i,r){Le.setVisible(i,r),r?fR(i):ER(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},Id(i,r,e){let t={},n;if(X(r))n=Ve.get(i,r,t);else{let o=r;n=Ve.get(i,o.type,pn(o.options||{},t))}return e!=null&&(n.typeId=e),n},Md(i,r,e,t,n){let o=Wt.Id(i,r,n);Wt.setPreparedConnector(i,o,e,t,n)}};function DS(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function yR(i,r,e){for(let t in r)i[t]=e}var uM="connector",pM="override",gM="cssClass",xR="__default",mM="anchor",EM="anchors";function VE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return yR(e,t,xR),i.$types.forEach(o=>{if(o!==xR){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([uM,mM,EM]);if(s.mergeStrategy===pM)for(let l in s)a.add(l);n=pn(n,s,[gM],Array.from(a)),yR(e,s,o)}}}),r&&(n=ho(n,r,"_")),Ks(i)&&wS(i,n,e),e}function Ks(i){return i.objectType===GE}var GE="connection";function NS(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&Ks(i)&&Pr(i,e.cssClass)}function yu(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var fM="add",yM="remove";function IS(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||G(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var Le={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=DS(r),n=!1,o=s=>i.$types.has(s)?(NS(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&VE(i,e)}},addType(i,r,e){let t=DS(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&VE(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,yu(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,yu(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{NS(i,e)}),i.$types.clear(),VE(i,r)},setType(i,r,e){return Le.clearTypes(i),(DS(r)||[]).forEach(i.$types.add,i.$types),VE(i,e)},applyType(i,r,e){Le.setPaintStyle(i,r.paintStyle),Le.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function bR(i,r){return r.theta-i.theta}function AR(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var MS={[vt]:AR,[Pt]:bR,[Ot]:bR,[Ct]:AR};function VS(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,g=i.x+p,m=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=He({x:g,y},i.c,i.r);g=f.x,y=f.y}a.push({x:g,y,xLoc:m,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Bo(i){return!i.isFixed&&i.isContinuous===!0}function GS(i){return[i.currentLocation,i.locations[i.currentLocation]]}function xM(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=Qt(i,o,n),a=Qt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function xu(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=He(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function SR(i,r,e,t,n,o,s,a){let l=Nr(r),h=rb(r),d=s(e,t,l,h);d.sort((p,g)=>{let m=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=g.axis===l&&g.directionFromParent===r.directionFromParent,x=g.axis===l&&g.directionFromParent!==r.directionFromParent;return m||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let g=d[p],m=e+g.dx,E=t+g.dy,y=g.axis,x=g.directionFromParent,f=r.ax+g.dx*n,b=r.ay+g.dy*n,A=i.getCell(m,E,null,null),T=A===a,S={cx:m,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(m-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function $S(i){let r=[],e=Nr(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Nr(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Nr(i),length:o}}function bM(i){return i.axis===En||i.axis===kn}function AM(i){return i.axis===ue&&i.source.ax===i.target.ax||i.axis===re&&i.source.ay===i.target.ay}function TR(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function SM(i,r,e){if(bM(i)||AM(i))TR(i,r,e);else{let t=i.axis===re?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===ue?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===re?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===ue?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===ue?re:ue,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function vR(i,r,e){if(e===re)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===ue)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===En)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===kn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function BS(i,r,e,t,n,o){let s=i,a=[];n=n||G();let l=$S(s);if(l.isFirstSegment)t===Jr?TR(l,a,n):SM(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,g=$S(l.target);for(;!p&&g!=null;){let m=vR(d,u,l.axis),E;E=vR(g.isFirstSegment?g.target.ax:g.target.cx,g.isFirstSegment?g.target.ay:g.target.cy,g.axis);let y=gx(m,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=g),g.isFirstSegment?p=!0:g=$S(g.target)}g!=null&&a.push({ax1:g.target.ax,ay1:g.target.ay,ax2:d,ay2:u,pathId:n,axis:g.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function CR(i,r,e,t,n,o){let s=BS(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},g=u+1,m=!1;for(;!m;){let E=s.segments[g];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:g-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[g-1].ax2,ay2:s.segments[g-1].ay2},finished:E==null};g++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function PR(i,r,e,t,n,o,s,a,l,h,d,u,p,g,m,E,y){E==null?E=new vs(i,r,s,h,d,u):E.reinitialize();let x=E.Uo(i.x,i.y),f=E.Uo(r.x,r.y),b=bm(n);b.axis==null&&(b.axis=tb(i,r));let A=bm(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:ym,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let R=T,v=S,O=()=>a===Jr?CR(v,R,E,a,m,y):BS(v,R,E,a,y,!0),P=new Xc,I=new gs(P.sort.bind(P),T),C,_,w=fc(T.x,T.y,S.x,S.y)*100,$=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,_=Nr(C),$++,$>w)throw`too many iterations ${$} `;if(C===S)return O();P.node=C;let N=SR(E,C,C.x,C.y,s,u,g,S);for(let M=0,D=N.length;M<D;M++){let V=N[M];if(V.isTarget)return V.obj.parent=C,O();if(V.obj.closed||V.obj===T||V.obj===S||V.obstacles.length>0||V.buffers.length>0)continue;let J=0;V.axis!==_&&(J=.5),(!V.obj.opened||V.g<V.obj.g)&&(V.obj.g=V.g,V.obj.h=l(V.cx,V.cy,S.x,S.y)+J,V.obj.f=V.obj.g+V.obj.h,V.obj.parent=C,V.obj.ax=V.ax,V.obj.ay=V.ay,V.obj.opened?I.update(V.obj):(I.add(V.obj),V.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:ym,isEmpty:!0}}function FS(i,r,e,t,n,o,s,a,l,h,d,u,p,g){return PR(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(m,E,y,x)=>{if(l===Jr||l==null)return xm(m,E,y,x);if(l===_c)return xm(m,E,y,x);if(l===Kr)return Qx(m,E,y,x)},(m,E)=>{let y=a*d;return s.hasLineOfSight(E,y,m.sourceAndTargetObstacles)},p,g)}var TM=10;function vM(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=Sx([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var Fl=class{constructor(r,e){this.instance=r;c(this,"Vd");c(this,"$anchorLists",new Map);c(this,"Gd");c(this,"Ti");c(this,"vi");c(this,"Ci");c(this,"ts",new Map);c(this,"$d",null);c(this,"dt");e=e||{},this.Ti=e.gridCellSize||TM,this.Gd=e.avoidVertices===!0,this.vi=e.vertexBuffer||2,this.Ci=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=Dt(t),a=Xn(t),l=Dt(n),h=Xn(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(H(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=He(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(H(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=He(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.Bd(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),g=this.Bd(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});$A(r.connector);let m={sourcePos:p,targetPos:g,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=lE(o,m),sE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!uE(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!uE(g,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&Ii(r),o.edited){let x=this.bE(r,o,m,e,E,y);Ve.setGeometry(r,x,!1)}else{let x=this.AE(r,o,m,e);Ve.setGeometry(r,x,!0)}aE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.SE(r,e)}$connectionRemoved(r){Bo(r.connection.anchors.source)&&this.Fd(r.connection.sourceId,r.connection.anchors.source),Bo(r.connection.anchors.target)&&this.Fd(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.ut){e=e||G();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=Bo(a.anchors.source),u=Bo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),g=(a.anchors.target.faces||[]).join("-"),m=[l,p,h,g].join("-"),E=o[m];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.rs(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Se,t),this.rs(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Se,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.TE(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,m),o[m]=E),d&&this.rs(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.rs(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.vE(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.ts.clear()}SE(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;wt(o.top,s),wt(o.left,s),wt(o.bottom,s),wt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}CE(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=xu(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=GS(r);if(r.locations.length===1||s==null||a==null)t=xu(h,n,o,e);else{let[d,u]=this.OE(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=xu(u,n,o,e)}}return r.computedPosition=t,t}vE(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(MS[o]),p=o===Et||o===Se,g=VS(t,u,l,h,p);for(let m=0;m<g.length;m++)g[m].a.locations[0]={x:g[m].xLoc,y:g[m].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},g[m].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Se,t,e.top,!0,0,{x:0,y:-1}),n(ze,t,e.left,!1,0,{x:-1,y:0}),n(Et,t,e.right,!1,1,{x:1,y:0})}rs(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,g=-1,m={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=m;else{let f=l?g!==-1?g:0:E.length;E.splice(f,0,m)}e.currentFace=h}Fd(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;wt(o.top,a),wt(o.left,a),wt(o.bottom,a),wt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}Bd(r,e){let t=this.CE(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}AE(r,e,t,n){return this.Gd||r.avoidVertices?this.PE(r,e,t,n):this.is(r,e,t)}bE(r,e,t,n,o,s){return Ve.update(r,e.paintInfo,t,o,s)}is(r,e,t){return Ve.compute(r,e.paintInfo,t)}PE(r,e,t,n){if(e.edited)this.is(r,e,t);else{let o=e,s=US(t.sourcePos,e.sourceGap),a=US(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),g=Math.max(l.y,h.y),m={x:d,y:p,width:Math.max(u-d,10),height:Math.max(g-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(m,0,[],!1))return this.is(r,e,t);(this.dt==null||n!==this.Vd)&&(this.dt=new vs(l,h,this.Ti,this.Ci,this.vi,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.Vd=n;try{let E=r.edge?r.edge.id:r.id,y=FS(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.Ti,o.constrain,fc,this.Ci,this.vi,this.dt,E);if(y.isEmpty)Ve.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:Ts(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:Ts(a.ox,a.oy),pathId:E});let x=EE(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||CM(b)},b)));return Kd(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.is(r,e,t)}}}TE(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.$d){let v=this.ts.get(p);if(v!=null)return v}else this.ts.clear();this.$d=u;let g={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:g.IDENTITY,a:[Se,Se]};let m=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,O)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[ze]:{x:O[P][0].x,y:O[P][0].c.y},[Et]:{x:O[P][0].x+O[P][0].width,y:O[P][0].c.y},[Se]:{x:O[P][0].c.x,y:O[P][0].y},[ht]:{x:O[P][0].c.x,y:O[P][0].y+O[P][0].height}},O[P][1]!=null&&O[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=Tx(x[v[P]][I],O[P][1])})([nt,fn],[[t,a],[n,l]]);let f=[Se,ze,Et,ht];for(let v=0;v<f.length;v++)for(let O=0;O<f.length;O++)y.push({source:f[v],target:f[O],dist:Math.round($e(x.source[f[v]],x.target[f[O]]))});y.sort(function(v,O){if(v.dist<O.dist)return-1;if(O.dist<v.dist)return 1;{let P={[ze]:0,[Se]:1,[Et]:2,[ht]:3},I=P[v.source],C=P[O.source],_=P[v.target],w=P[O.target];return I<C?-1:C<I?1:_<w?-1:w<_?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let O=y[v];if(!Bo(o)||DE(o,O.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=rE[P],_=this.Ti*(this.Ci+this.vi),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Bo(s)||DE(s,O.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=rE[P],_=this.Ti*(this.Ci+this.vi),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(_*C.x)),height:Math.max(1,Math.abs(_*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let R={a:[b,A],theta:m,theta2:E};return this.ts.set(p,R),R}OE(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,g)=>{let m=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:m,y:E,idx:g}}),d=l.locations.map((p,g)=>{let m=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:g,x:m,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let g=0;g<d.length;g++){let m=Math.round($e(h[p],d[g]));u.push({d:m,idx:p,idx2:g})}return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,g)=>({d:vM(p,h,d,r,e,o,s),idx:g}));return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}}};c(Fl,"type",xe);function CM(i){return i.axis!=null?i.axis:i.ax1===i.ax2?ue:i.ay1===i.ay2?re:null}function US(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var zS="fill",$E="stroke",YS="stroke-width",PM="strokeWidth",Pe="svg",XS="defs",te="path",Xe="circle",jS="ellipse",Qe="text",BE="tspan",Z="rect",q="g",OM="version",_M="xmlns",RM="fill",FE="stroke-dasharray",LM="stroke-linejoin",wM="stroke-linecap",DM="stroke-miterlimit",NM="stroke-dashoffset",IM="stroke-opacity",MM="stroke",VM="stroke-width",bu="vector-effect",Au="non-scaling-stroke",GM="text-anchor",Mt="http://www.w3.org/2000/svg",$M="http://www.w3.org/1999/xlink",BM="http://www.w3.org/1999/xhtml";var Su=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Me,_e],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var OR=.5;function HS(i,r){var b,A;let e=IS(i,GE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=ii(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[fu]={type:pr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||OR,id:fu,cssClass:LS,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=ii(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=ii(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=bt(l,d),g=bt(h,u),m=i.$_edgesDetachable;r.detachable===!1&&(m=!1);let E=i.$_reattachEdges===!0,y=ws({},r.paintStyle||i.defaults.paintStyle);Le.appendToDefaultType(e,{detachable:m,reattach:E,paintStyle:y,hoverPaintStyle:ws({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:g},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:m,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[nt]:[],[fn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});Wt.Md(x,r.connector||i.$defaultConnector,!0);let f=[xe,r.type].join(" ");return/[^\s]/.test(f)&&Le.addType(x,f,r.data),x}var Ul=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Tu=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var _R={},tn={get:i=>{let r=_R[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{_R[i]=r}};function ke(i){return function(r){tn.register(i,r)}}function vu(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let g=(isFinite(i.xmax)?i.xmax:0)+u+l,m=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||g,g),y=Math.min((a==null?void 0:a.height)||m,m);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function kS(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=bt(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===nt?n.anchors.source=l:n.anchors.target=l,Wt.setVisible(n,o.originallyVisible),s}return null}function WS(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(z(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=bt(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=bt(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=cA(o.proxies[e]),l=a!=null?a.originalElement.id:e===nt?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===nt?o.anchors.source:o.anchors.target;e===nt?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),Wt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var FM=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function UE(i,r,e){r!=null&&($g(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Nl)),e!=null&&(r==null||i.sourceId!==i.targetId)&&($g(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Nl))}function zE(i,r,e){if(r!=null){let t=r.connections.length;wt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Nl)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&wt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Nl)}}var UM=2,zM=2,Cu=class extends Vt{constructor(e,t,n,o,s){var l,h,d,u,p,g,m,E,y,x,f,b,A,T;super();c(this,"Fa",[]);c(this,"Ua",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Oi",{});c(this,"hoverSuspended",!1);c(this,"ut",!1);c(this,"Ud",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"connectorClass",ks);c(this,"connectorOutlineClass",dS);c(this,"connectorPathClass",cS);c(this,"overlayClass",Ws);c(this,"labelOverlayClass",pS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"os");c(this,"viewport",new gu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"za",new Map);c(this,"me");c(this,"Ya",new Set);c(this,"zd");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"Yd");c(this,"Xd");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"W",1);c(this,"$collapsedGroupSizeCalculator");c(this,"jd");c(this,"Xa");c(this,"ja");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"kd");c(this,"$relayoutOnResize");c(this,"ss");c(this,"rootElement");c(this,"wt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||G(),this.gridProfile=new Ul(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||Cn,this.Yd=(h=o.edges)==null?void 0:h.sourceMarker,this.Xd=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>ii(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((g=o.edges)==null?void 0:g.anchors)||[null,null],this.kd=o.refreshLayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.defaults={[hu]:null,[AS]:1,[Vo]:{strokeWidth:2,stroke:"#000000"},[CE]:"vjs_defaultscope",[vE]:!0,[xS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Oi,this.defaults),this.Oi[Vo]!=null&&(this.Oi[Vo].strokeWidth=this.Oi[Vo].strokeWidth||2),this.zd=this.defaults[CE],this.allowNestedGroups=this.Oi[vE]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[fS]:UM,this.$_vertexBorder=o.edges?o.edges[ES]:zM,this.os=((m=o.edges)==null?void 0:m.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new Fl(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.os}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Tu(o.magnetizer||{}),this.magnetizer=new Ti({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,R)=>{}}),this.ss=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.ss=!1),this.setContainer(n),this.$setView(o.view),this.ka(ft,S=>{let R=this.$_connMap[S.edge.getId()];if(R){let v=this.dataSource.getEdgeType(S.edge.data),O=[...new Set([xe,v])];if(this.$_setConnectionType(R,O.join(" "),S.edge.data),this.ss===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(R,P,!0)}this.ie(P=>{P.$edgeUpdated(S.edge,R)})}}),this.ka(qc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.ie(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.ka(Kc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.ie(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=rt.get(ys.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:uo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.jd=o.defaultCollapsedGroupSize||{width:200,height:150},this.Xa=o.canCollapseGroup,this.ja=o.canExpandGroup}get defaultScope(){return this.zd}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.W}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.target)&&(s=this.Hd(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this._E(n,s,!bi(e.old))):(delete this.$_connMap[t.getId()],this.Ha(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(K(e.obj)||z(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Bi)}else if(tt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Ml)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Bi)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||z(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Bi)}else if(tt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Ml)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Bi)}}$selectionCleared(e){this.$getSelector(this.me,Y(Ml)).forEach(t=>this.$removeClassFromElement(t,Ml)),this.$getSelector(this.me,Y(Bi)).forEach(t=>this.$removeClassFromElement(t,Bi))}Hd(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.source)&&(s=this.Hd(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.RE(n,s,!bi(e.old)):(delete this.$_connMap[t.getId()],this.Ha(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind(Oi,e)}ka(e,t){this.Fa.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(md)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=G();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(xn)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=z(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.as(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}Wd(){let e,t,n,o,s,a=!1,l=G();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.Zd(h[e],il,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.wt.length!==0}LE(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,Vi)||this.$getAttribute(e,Yr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,Gi)||this.$getAttribute(t,Yr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return FM.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}wE(e,t,n,o){var R,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,g=this.getElement(p.id),{sourceDef:m,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.LE(u.el,g.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.Yd,targetMarker:h.targetMarker||this.Xd};[lu,yS,bS].forEach(O=>{h.hasOwnProperty(O)&&(f[O]=h[O])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(O,P,I,C,_)=>{if(C&&C[I]){let w=O[P]||[C[I],C[I]];w[_]=C[I],O[P]=w}};m!=null&&A(f,Gl,Vl,m,0),E!=null&&A(f,Gl,Vl,E,1);let T=f;if(T.avoidVertices=this.os||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,ho(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(R=s.anchors)!=null&&R.source)f.anchors[0]=bt(s.anchors.source);else{let O=a.positionOnSource||{x:0,y:0},P=m.anchorPositions||y.anchorPositions,I=m.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=mu(P.slice(),null,O);else if(I!=null){let C=I(u.el,O,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=bt(s.anchors.target);else{let O=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=mu([a.targetAnchor]);else if(P!=null)f.anchors[1]=mu(P.slice(),null,O);else if(I!=null){let C=I(g.el,O,s.target,E);f.anchors[1]=C}}this.ss===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=HS(this,f);if(S!=null){UE(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(Ve.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.kd&&this.refresh(),(g.visible===!1||u.visible===!1)&&this.ls(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let O={connection:S,edge:s,reason:e.reason};this.ie(P=>P.$edgeRendered(O)),this.fire(mb,O)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.Jn(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.ie(o=>{o.$groupRemoved(t)})),t}Zd(e,t,n,o,s,a){this.wt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.wt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.wt.length;s++)this.DE(this.wt[s],e)==null?o.push(this.wt[s]):n.push(this.wt[s].edge);this.wt=o}return n}DE(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.wE(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.Zd(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.Ha(n,{fireEvent:!1,force:!0}),this.ie(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?Ve.importGeometry(o,t):Ii(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(Zn,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:Ur(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges(G()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.ie(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.Jd(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===Vs&&this.os){let d=this.model.getAllEdges().filter(u=>jn(u.source).id!==e.vertex.id&&jn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===vd?this.NE(this.getElement(t.id),e.originalData):this.fire(Ns,this.getElement(t.id)),this.ie(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}NE(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=z(e.modelObject)?Vr:It;this.fire(s,o)}IE(e){this.fire(Re,e)}getLayoutFor(e){return Wg(e)||Zg(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,zb),this.ie(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.ie(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.ie(o=>{o.$nodeRemoved(t)}),this.IE(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,Dl),this.$removeAttribute(n.el,Yr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&Wt.Md(o,s.connector),Le.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=K(e),a=z(e);this.$setAttribute(t,ee,e.getFullId());let l=s?$i:a?Mo:H(e)?gS:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,_t,this.$getAttribute(h.el,_t)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Bi)),K(e)||z(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let m=this.Kd(e.group);this.$appendElement(t,m)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let g=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.Jd(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let m={el:t,id:e.id,vertex:e,size:u};this.fire($r,m)}}else if(z(e)){let m={el:t,vertex:e,id:e.id,size:u},E=g,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:uo.type};this.layoutMap.set(e.id,this.qd(x,e)),this.fire(Gr,m),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.ie(m=>{m.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=G();this.Qd(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t){let n=e.connections||[];return this.Qd(n,t),n}Qd(e,t){this.router.$redrawConnections(e,t),e.forEach(n=>{this.$paintConnection(n,{timestamp:t})})}ls(e,t,n){let o=this.$_connMap[e.id];o&&Wt.setVisible(o,t)}isVisible(e){return this.eu(e,t=>{switch(t.type){case Be.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case de.objectType:case ie.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Be.objectType:this.ls(s.obj,t,n);break;case de.objectType:case ie.objectType:this.ME(s,t,n);break;case he.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.eu(e,o)}ME(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.Yb=t,e.managedElement.visible=t,this.fire(Ed,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.ls(o[s],t,n);else{let a=jn(o[s].source),l=jn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ls(o[s],t,n)}}}eu(e,t){let n;if(tA(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=K(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.me}setZoom(e,t){return this.W=e,e}j(e){if(e==null)return null;let t=this.$getAttribute(e,_t);return(!t||t==="undefined")&&(t=`vjs-${G()}`,this.$setAttribute(e,_t,t)),t}setContainer(e){this.me=e}tu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}RE(e,t,n){zE(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.tu(e,t,0,n);UE(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}_E(e,t,n){zE(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.tu(e,t,1,n);UE(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=Le.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.ut;return this.ut=e,e?this.Ud=""+new Date().getTime():this.Ud=null,this.ut||(this.autoSizeGroups(Array.from(this.Ya.keys()).map(o=>o.modelObject)),this.Ya.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.ut===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}VE(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}Ha(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.VE(e)===!0)?(zE(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:nl,edge:e.edge}),delete this.$_connMap[e.id],Wt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,_t)==null&&this.$setAttribute(e,_t,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.ut||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.j(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,_t),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},Is,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},Qb,!1)},ut)}Jd(e,t,n,o){let s=X(e)?e:e.id;if(this.getElement(s)){this.viewport.xE(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.ie(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((K(s.modelObject)||z(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(H(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.j(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):pu()}repaintEverything(e){let t=G();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=pu(),a=l=>{l.forEach(h=>s.add(h))};if(!this.ut){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.j(h))).filter(h=>h!=null&&h.id!==e.id);if(t==null&&(t=G()),!n)for(let h=0;h<l.length;h++)this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t))}o&&this.fire(ud,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.wt.length=0,this.$unrenderedVertices.clear(),this.Ya.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(z)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.Ua.length;e++)this.off(this.me,this.Ua[e][0],this.Ua[e][1]);this.reset(),this.unbind(),this.za.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.za.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=ii(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=ii(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=ii(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.za.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===nt?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===fn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),zE(n,h,d),UE(n,a,l))}Wa(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=gn(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.Za(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,g=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||g<0)){let m=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let m=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.ja?this.ja(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.ru(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[TE],[SE]);let l=new Set,h=new Set,d=new Set;this.nu(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let g in p)this.model.updateVertex(g,p[g])}this.Wa(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.ie(p=>{p.$groupExpanded(n)}),this.fire(gd,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){WS(this,e,t,n,o)}$_unproxyEdge(e,t,n){return kS(this,e,t,n)}nu(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=Kg(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=qa(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?fn:nt})}),h.right.forEach(d=>{o.add(d)}),this.iu(e).forEach(d=>{this.nu(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(X(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}ru(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.Xa==null?null:this.Xa(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.ru(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[SE],[TE]);let h=new Set,d=new Set;this.ou(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let g in p)this.model.updateVertex(g,p[g])}this.Wa(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.ie(p=>{p.$groupCollapsed(n)}),this.fire(pd,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.jd}iu(e){return e.modelObject.members.filter(t=>t.objectType===ie.objectType).map(t=>this.viewport.getGroupElement(t.id))}ou(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=Kg(e.modelObject,!0,!0);if(e.proxied!==!1){let a=qa(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?fn:nt})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.iu(e).forEach(a=>{this.ou(a,t,n)})}GE(){return this.su(this.dataSource.getGroups().filter(this.objectFilter))}su(e){let t=[];return e.forEach(n=>{let o=gn(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=z(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(ml,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===Ub&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=pu();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.$E(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.au(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},bn,t)}refresh(e){this.au(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Ds,e)}au(e,t,n,o){if(!this.ut){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let m in l)p.push(this.dataSource.getVertex(m));this.magnetizer.setElements(p);let g=this.magnetizer.executeAtCenter({getPosition:m=>l[m.id],getSize:m=>a.sizes[m.id]});for(let m in g.current)l[m]=g.current[m]}let h=this.BE(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(m,E)=>h.info[m].positions[E]||this.getElementPosition(E),g=(m,E)=>a.sizes[E]||h.info[m].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(m=>{let E=xi();m.group.members.forEach(x=>{let f=p(m.group.id,x.id),b=g(m.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.Za(m.group,l,a.sizes,E,!1);if(y!=null&&(s[m.group.id]={group:m.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[m.group.id]!=null&&(l[m.group.id]=y.position),u[m.group.id]=this.$_getGroupContentAreaInfo(m.group.id),a.sizes[m.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[m.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let g=p.group.id,m=h.info[g],E=l[g]||Dt(m.element),y=u[g]||this.$_getGroupContentAreaInfo(g);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:m.positions,sizes:m.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(ml,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=G();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.ut&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,Wt.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}}e.lastPaintedAt=n}}$addOverlay(e,t,n){let o=Bl(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){$o(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),yu(e),n&&this.$paintConnection(e)}$setView(e){this.view=new uu(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height};return(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(s=>{let a=K(s.modelObject),l=a&&Wg(s.modelObject),h=z(s.modelObject),d=h&&Zg(s.modelObject),u=e.dontIncludeNodes===!0&&a,p=e.dontIncludeGroups===!0&&h,g=e.dontIncludeNodesInsideGroups&&l,m=e.dontIncludeNestedGroups&&d;return!(u||p||g||m)}).map(s=>({enclosed:e.enclosed,id:s.id,r:s,v:s.modelObject,el:s.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}Kd(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(Ks(e)){let n=e.edge;return{obj:n,id:n.id,type:Be.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.j(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===Be.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}Ja(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}FE(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let m=this.getObjectInfo(e,!1);if(m.obj)if(!l)p.focus=m.obj.id;else{let E=this.getElement(m.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===m.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let g=this.getGrid();return g&&(p.grid=g),p}cs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.Ja());let p=this.FE(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}as(e,t,n,o,s,a,l,h,d){let u=this.cs(e,t,n,o,s,null,a,l,h,d);this.hs(u,Kb)}magnetize(e,t){this.as(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.cs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.cs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.as(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.as(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.Ja(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}lu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}UE(e,t){let n=this.lu(t);this.model.updateVertex(e,n)}hs(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.lu(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),Ce(l.data,s,n.x),Ce(l.data,a,n.y)),n}$E(e,t){let n=X(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),Ce(n.data,this.$modelWidthAttribute,t.width),Ce(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.zE(a.obj,t,n,o,s===!1,!1,!1,!1);this.hs(l,vd)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.hs({original:{},current:u},vd,()=>{this.Wa(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.qd(t,n.obj)),this.relayoutGroup(n.obj,Fb),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}zE(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.cs(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.YE()&&(d=ae(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);Ce(l.data,n,h.x),Ce(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new Ul({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}YE(){return this.gridProfile!=null&&this.gridProfile.snap}Xb(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=ae({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.Ja());let o=this.magnetizer.snapToGrid(t);return this.hs(o,qb),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.su(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.XE(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}XE(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.Za(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}BE(){let e={orderedGroups:this.GE(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(Jc,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.ie(l=>{l.$groupResized(n)}),this.model.fire(_e,{vertex:o,updates:s,originalData:o.data,reason:Jb},null)}}}Za(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),g=this.$_getGroupContentAreaInfo(e.id),m=g.contentArea,E=0,y=0,x,f,b=p(e.id),A=g.isGroupElement?p(e.id):this.$getSize(m),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),R=Object.assign({},u(e.id)),v,O=null;if(O!=null)E=O.layoutShiftX,y=O.layoutShiftY,x=O.width,f=O.height,v={x:R.x-E,y:R.y-y};else{let P=vu(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:R.x-E,y:R.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(m,x,f),!g.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,_=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),_<0&&(this.$setElementHeight(m,S-g.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),_>0&&(this.$setElementHeight(m,S-g.internalOffset.y),_=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}cu(e){let t={container:this.me,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:Ce(n.data,this.$modelLeftAttribute),y:Ce(n.data,this.$modelTopAttribute)})),rt.get(e.type,t)}qd(e,t){let n=this.Kd(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:Ce(s.data,this.$modelLeftAttribute),y:Ce(s.data,this.$modelTopAttribute)};return X(a.x)&&(a.x=parseInt(a.x,10)),X(a.y)&&(a.y=parseInt(a.y,10)),a}),rt.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.cu(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.cu(e).layout(n=>{for(let o in n.positions)this.UE(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[$i,mS].join(" "),{[ee]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}hu(e){(e.plugins||[]).forEach(n=>{this.du(n,!0)})}addPlugin(e){return this.du(e,!0)}du(e,t){let n=X(e)?e:e.type,o=X(e)?{}:e.options||{},s=tn.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),t&&this.fire(fd,s),s}getPlugin(e){return this.pluginMap.get(e)}ie(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.W};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!X(e)&&Array.isArray(e)}};var YM=20,XM=20,YE=class YE extends _n{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",YE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||YM,this.length=n.length||XM,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let m=this.location<0?1:0;o=Ye(e,m,this.location,!1),s=Ye(e,m,this.location-this.direction*this.length/2,!1),a=zt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=Ye(e,this.location,-this.length),a=zt(o,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=Ye(e,this.location,this.length),o=zt(a,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else o=Ye(e,this.location,this.direction*this.length/2),s=dr(e,this.location),a=zt(o,s,this.length);l=Qt(o,a,this.width),h=zt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(YE,"type","Arrow");var Or=YE;at.register(Or.type,Or);var XE=class XE extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",XE.type);this.foldback=1}};c(XE,"type","PlainArrow");var Pu=XE;at.register(Pu.type,Pu);var jE=class jE extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",jE.type);this.length=this.length/2,this.foldback=2}};c(jE,"type","Diamond");var Ou=jE;at.register(Ou.type,Ou);var HE="Custom",kE=class extends ni{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",HE);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function rn(i){return i.type===HE}at.register(HE,kE);var RR=5,WE=class WE extends _n{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Ce");c(this,"Fr");c(this,"type",WE.type);c(this,"contentTags",[Xe]);n=n||{},this.Ce=n.radius||RR,this.Fr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.Fr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=Ye(e,this.location,this.Ce);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=Ye(e,this.location,this.Ce);l=zt(d,u,this.Ce),h=Ye(e,this.location,2*this.Ce)}else if(this.location===1)if(this.Fr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=Ye(e,this.location,-this.Ce);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=Ye(e,this.location,-this.Ce);l=zt(d,u,this.Ce),h=Ye(e,this.location,-2*this.Ce)}else l=dr(e,this.location),h=Ye(e,this.location,this.Ce);return{atts:[{cx:l.x,cy:l.y,r:this.Ce,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Ce,xmax:l.x+this.Ce,ymin:l.y-this.Ce,ymax:l.y+this.Ce,tail:h}}};c(WE,"type","Dot");var _u=WE;at.register(_u.type,_u);var LR=10,wR=10,ZE=class ZE extends _n{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"uu");c(this,"Fr");c(this,"type",ZE.type);c(this,"contentTags",[te]);n=n||{},this.width=n.width||LR,this.height=n.height||wR,this.uu=n.rotate===!0,this.Fr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,R;if(this.uu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},O,P;this.Fr==="center"?(P=Ye(e,this.location,this.width/2),O=zt(P,v,this.width)):(O=v,P=Ye(e,this.location,this.width)),S=Qt(P,O,this.height),R=Qt(O,P,this.height),g=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},O,P;this.Fr==="center"?(P=Ye(e,this.location,-this.width/2),O=zt(P,v,this.width)):(O=v,P=Ye(e,this.location,-this.width)),S=Qt(O,P,this.height),R=Qt(P,O,this.height),g=P}else{let v=Ye(e,this.location,this.width/2),O=dr(e,this.location),P=zt(v,O,this.width);S=Qt(v,P,this.height),R=Qt(P,v,this.height),g=P}m=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=R[1].x,b=R[1].y,A=R[0].x,T=R[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=dr(e,this.location),g=v,m=v.x-this.width/2,E=v.y-this.height/2,y=m+this.width,x=E,f=y,b=E+this.height,A=m,T=E+this.height}return h=Math.min(m,y,f,A),d=Math.max(m,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${m} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:g}}};c(ZE,"type","Rectangle");var Ru=ZE;at.register(Ru.type,Ru);var DR=8,NR=5,JE=class JE extends _n{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",JE.type);c(this,"contentTags",[jS]);n=n||{},this.rx=n.rx||DR,this.ry=n.ry||NR}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=dr(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:Ye(e,this.location,(this.ry+this.rx)/2)}}};c(JE,"type","Ellipse");var Lu=JE;at.register(Lu.type,Lu);var wu=class{constructor(r,e){this.surface=r;c(this,"Jt");c(this,"pu");e=e||{edgeMappings:[]},this.Jt=e.edgeMappings||[],this.pu=this.surface.model.edgeTypeFunction,this.jE()}computeTypes(r){let e=[this.pu(r)];for(let t=0;t<this.Jt.length;t++){let n=this.Jt[t].property,o=this.Jt[t].mappings;if(X(n)){if(r[n]!=null){let s=X(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[ur]!=null&&r[n]!=null&&e.push(`${n}_${ur}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}jE(){for(let r=0;r<this.Jt.length;r++){let e=this.Jt[r].property,t=this.Jt[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=X(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.Jt}};function jM(i,r,e,t,n,o,s){return new Touch({target:i,identifier:G(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function HM(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function kM(i,r,e,t,n,o,s){return HM(jM(i,r,e,t,n,o,s))}function zl(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function Du(i){return i.srcElement||i.target}function ZS(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function WM(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var ZM=1,IR=!1,MR=!1;function Rn(){return IR||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function oi(){return MR||"onmousedown"in document.documentElement}function BR(i){IR=i}function FR(i){MR=i}var Ui={[pe]:Ab,[se]:Sb,[oe]:Tb};function JS(i,r){if(i==null)return{x:0,y:0};let e=Fo(i),t=ef(e,0);return r(t)}function ge(i){return JS(i,r=>({x:r.pageX,y:r.pageY}))}function JM(i){return JS(i,r=>({x:r.screenX,y:r.screenY}))}function KM(i){return JS(i,r=>({x:r.clientX,y:r.clientY}))}function ef(i,r){return i.item?i.item(r):i[r]}function Fo(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function eT(i){return Fo(i).length}function UR(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Fo(i),e=ef(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function KE(i,r,e,t,n){GR(i,r,e),t.Kt=e.Kt,i.addEventListener&&i.addEventListener(r,e,!1,n)}function Nu(i,r,e){e!=null&&VR(i,t=>{qM(t,r,e),e.Kt!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),Rn()&&Ui[r]&&t.removeEventListener(Ui[r],e,!1)),e.mu&&Nu(i,e.mu[1],e.mu[0])})}function VR(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function GR(i,r,e){let t=ZM++;return i.Ur=i.Ur||{},i.Ur[r]=i.Ur[r]||{},i.Ur[r][t]=e,e.Kt=t,t}function qM(i,r,e){if(i.Ur&&i.Ur[r]&&delete i.Ur[r][e.Kt],e.zr){for(let t=0;t<e.zr.length;t++)Nu(i,e.zr[t][0],e.zr[t][1]);e.zr.length=0}e.Ka&&e.Ka()}var QM=/:not\(([^)]+)\)/;function qE(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(QM);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(ur);let a=l=>{a.Kt=e.Kt;let h=Du(l),d=!1,u=h,p=ZS(l,h,r,i!=null);if(p.end!=-1)for(let g=0;!d&&g<p.end;g++){u=p.path[g];for(let m=0;m<s.length;m++)if(zl(u,s[m],r))return;for(let m=0;!d&&m<o.length;m++)if(zl(u,o[m],r)){e.apply(u,[l,u]),d=!0;break}}};return eV(e,t,a),a}}function eV(i,r,e){i.zr=i.zr||[],i.zr.push([r,e])}var QE=(i,r,e,t,n)=>{if(Rn()&&Ui[r]){let o=qE(t,i,e,Ui[r]);KE(i,Ui[r],o,e,n)}r===xb&&i.getAttribute(xE)==null&&i.setAttribute(xE,"1"),KE(i,r,qE(t,i,e,r),e,n)},KS={[W]:{touches:1,taps:1},[Br]:{touches:1,taps:2},[xt]:{touches:2,taps:1}};function $R(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var qS=class{static generate(r,e){return(t,n,o,s)=>{if(n==xt&&oi())QE(t,n,o,s);else{if(t.je==null){let a=t.je={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let g=Du(p),m=ZS(p,g,t,s!=null),E=!1;for(let y=0;y<m.end;y++){if(E)return;g=m.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||zl(g,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let g=Du(p),m,E;a.taps++;let y=eT(p);for(let x in KS)if(KS.hasOwnProperty(x)){let f=KS[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=ZS(p,g,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(m=E.path[A],a[x][b][1]==null||zl(m,a[x][b][1],t)){a[x][b][0].apply(m,[p,m]);break}}}}};t.je.downHandler=d,t.je.upHandler=u,QE(t,pe,d),QE(t,se,u)}t.je.downSelectors.push(s),t.je[n].push([o,s]),o.Ka=function(){t.je!=null&&(wt(t.je.downSelectors,a=>a===s),WM(t.je[n],o),t.je.downSelectors.length===0&&(Nu(t,pe,t.je.downHandler),Nu(t,se,t.je.upHandler),delete t.je))}}}}},QS=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Du(l);(o==null&&h==e&&!e.Me.over||zl(h,o,e)&&(h.Me==null||!h.Me.over))&&($R(Lm,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=Du(l);for(let d=0;d<r.length;d++)h==r[d]&&!zl(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),$R(wm,l,e,h))};KE(e,ot,qE(o,e,s,ot),s),KE(e,it,qE(o,e,a,it),a)}n.Ka=function(){delete e.Me[t][n.Kt]},GR(e,t,n),e.Me[t][n.Kt]=n}}},fe=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=QS.generate(),this.tapHandler=qS.generate(this.clickThreshold,this.dblClickThreshold)}kE(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Br||e===xt?this.tapHandler(s,e,t,n,o):e===Lm||e==wm?this.mouseEnterExitHandler(s,e,t,n,o):QE(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.kE(r,e,a,s,o),this}off(r,e,t){return Nu(r,e,t),this}trigger(r,e,t,n,o){let s=oi()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=Rn()&&!oi()&&Ui[e]?Ui[e]:e,l=!(Rn()&&!oi()&&Ui[e]),h=ge(t),d=JM(t),u=KM(t);return VR(r,p=>{let g;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let m=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=kM(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&Rn()&&Ui[e],x=y?"TouchEvent":"MouseEvents";g=document.createEvent(x),E[x](g),m(g),p.dispatchEvent(g)}),this}};var tV=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ce(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function B(i,r,e,t){return r=r||{},Qs(Mt,i,e,t,r)}function zR(i,r){let e=r.map(t=>B("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function rV(i,r){i.gradient==null&&(i.gradient=B("linearGradient",{id:Ka(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),zR(i.gradient,r)}function tT(i,r,e){let t=Ka(),n=B("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return zR(n,e),{id:t,g:n}}function tf(i,r,e,t){r.setAttribute(zS,e.fill?e.fill:pt),!t&&e.gradient?(rV(i,e.gradient),r.setAttribute($E,`url(#${i.gradient.id})`)):r.setAttribute($E,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(YS,e.strokeWidth),e.dashArray?r.setAttribute(FE,e.dashArray):r.removeAttribute(FE),tV.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function qs(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function nV(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...iV(o,r,e))}),t}function iV(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=B(BE);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function oV(i,r,e){return nV(i,r,e).map(t=>{let n=B(BE);return n.innerHTML=t,n})}function Iu(i,r,e){let n=i.getAttribute(Q)||"50%",o=oV(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(Q,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var rf="data-vjs-container",nf="data-vjs-group-content",Mu="data-vjs-expanded-content",Vu="data-vjs-collapsed-content",gr="data-vjs-enabled",Uo="data-vjs-scope",Yl="data-vjs-is-group",sV="element",aV="connection",We="div",of="position",Hr=Y(ks),rT=be(nf),Ln=Y(Ws),nT=Y(su);function Gt(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function le(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Zt(i,r,e,t){if(t&&Gt(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if(Gt(i,r))return i;i=i.parentNode}}function lV(i,r,e){e=e||document.body;let t=[],n=Zt(i,r,e,!1);for(;n!=null;)t.push(n),n=Zt(n,r,e,!1);return t}function zo(i){return i.srcElement||i.target}function YR(i,r){r=St(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function sf(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function XR(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=sf(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),YR(i,s.join(" "))}function wn(i){return!X(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function hV(i){return!X(i)&&(Array.isArray(i)||wn(i))}function oT(i){return!X(i)&&(Array.isArray(i)||wn(i))}function sT(i){return sf(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?St(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):XR(t,n))};wn(i)?i.forEach(t=>e(t,r)):e(i,r)}function nn(i,r){return i.classList?i.classList.contains(r):sf(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?St(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):XR(t,null,n))};wn(i)?i.forEach(t=>e(t,r)):e(i,r)}function af(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):nn(t,n)?F(t,n):L(t,n))};wn(i)?i.forEach(t=>e(t,r)):e(i,r)}function $t(i,r=[],e=[]){let n=sf(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),YR(i,n.join(" "))}function aT(i,r){let e=null;if(arguments.length===1){if(!X(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function kr(i,r,e,t){return Qs(null,i,r,e,t)}function Qs(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),ce(o,n||{}),o}function Wr(i,r,e,t,n,o,s){let a=Qs(i,r||We,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function zi(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function Gu(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Rt(i){return Gu(i)==="SVG"}function Yi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var iT=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function ea(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function ta(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===Xt?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function $u(i,r,e){let t=r.getBoundingClientRect(),n=ge(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function lT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function cV(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function si(i,r){return"["+i+"='"+r+"']"}function dV(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function uV(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function Y(...i){return i.map(r=>"."+r).join(",")}function pV(...i){return i.join(" ")}function be(...i){return i.map(r=>"["+r+"]").join(",")}var Xl=be(_t);function jl(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var jR="deltaY",HR="deltaX",gV="wheelDeltaY",mV="wheelDeltaX",lf="webkit",Hl="mac",Bu="win",hT="ie",cT="safari",dT="firefox",uT="default";function kR(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function WR(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var pT={[lf]:{[Hl]:jl(jR,120),[Bu]:jl(jR,100)},[cT]:jl(gV,120,!0),[dT]:{[Hl]:kR,[Bu]:kR},[hT]:function(i){return i.wheelDelta/120},[uT]:function(i){return i.deltaY||i.wheelDelta}},gT={[lf]:{[Hl]:jl(HR,120),[Bu]:jl(HR,100)},[cT]:jl(mV,120,!0),[dT]:{[Hl]:WR,[Bu]:WR},[hT]:function(i){return i.wheelDelta/120},[uT]:function(i){return i.deltaX||i.wheelDelta}},ZR=typeof navigator!="undefined",JR=ZR?/Mac/.test(navigator.userAgent)?Hl:Bu:Hl,kl=ZR?navigator.userAgent.indexOf("Firefox")!==-1?dT:/Chrome/.test(navigator.userAgent)?lf:/Safari/.test(navigator.userAgent)?cT:/WebKit/.test(navigator.userAgent)?lf:/Trident/.test(navigator.userAgent)?hT:"default":uT,EV=typeof pT[kl]=="function"?pT[kl]:pT[kl][JR],fV=typeof gT[kl]=="function"?gT[kl]:gT[kl][JR],yV=function(i){return EV(i||event)},xV=function(i){return fV(i||event)},bV=function(i,r,e){let t=n=>{let o=yV(n),s=xV(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.HE=t,t},AV=typeof document!="undefined",KR=AV?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function Wl(i,r,e,t){let n=bV(r,e,t);return i.addEventListener?i.addEventListener(KR,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function Zl(i,r){let e=r.HE;e!=null&&(i.removeEventListener?i.removeEventListener(KR,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function mT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var ET="vjs-paper",fT="vjs-paper-canvas",yT=20,SV="vjs-paper-node",Jl="start",Yo="center",Kl="end";function xT(i){return Xr(i)&&i.useHTMLElement===!0}var ql=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=kr(We,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(qe,t.edge.id),e.contentElement.setAttribute(ou,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=st,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,Il),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function bT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[ou]:r.id},r.attributes);e.forEach(n=>{let o=B(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&qs(n,t,-1)}}),r.contentElements}function AT(i,r,e,t){let n=r;bT(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);ce(a,d)})}function Ql(i,r){return bT(i,r,r.contentTags)}function Xo(i,r){return bT(i,r,[q]),r.bgElement==null&&(r.bgElement=B(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=B(Qe),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function ST(i,r,e,t){Xo(i,r);let n=un(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),ce(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,g={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};ce(r.bgElement,g)}function hf(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var Fu=class extends ni{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var ai="transform",TT=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,qR=/rotate\(([-0-9\.]+)\)/,TV=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function et(i){let r=i;return r.width&&r.width.baseVal?RV(r):r.getBBox?LV(r):vV(i)}function sn(i,r){let e=i;return Rt(i.parentElement)?eh(e,r):e.x&&e.x.baseVal?OV(e):CV(e)}function we(i,r){let e=i;Rt(i.parentElement)?on(e,r):(e.x&&e.x.baseVal&&_V(e,r),Jt(e,r))}function Uu(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function QR(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===q){let s=eh(o);s[n]=r,on(o,s)}}function vT(i,r){QR(i,r,ze,Q,Q)}function CT(i,r){QR(i,r,Se,Ee,Ee)}function _r(i,r,e){let t=i;t instanceof HTMLElement?eL(i,r,e):t.width&&t.width.baseVal&&(eL(i,r,e),i.setAttribute(ve,`${r}`),i.setAttribute(De,`${e}`))}function PT(i,r){let e=i;e instanceof HTMLElement?tL(i,r):e.width&&e.width.baseVal&&(tL(i,r),i.setAttribute(ve,`${r}`))}function OT(i,r){let e=i;e instanceof HTMLElement?rL(i,r):e.height&&e.height.baseVal&&(rL(i,r),i.setAttribute(De,`${r}`))}function vV(i){return{width:i.offsetWidth,height:i.offsetHeight}}function CV(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function PV(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function Jt(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function eL(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function tL(i,r){i.style.width=`${r}px`}function rL(i,r){i.style.height=`${r}px`}function OV(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function _V(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function RV(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function LV(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function eh(i,r){let e,t,n,o,s;if(e=i.getAttribute(ai),e!=null){if(t=e.match(TT),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(qR),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=He(h,{x:o,y:s},a),u=He({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match(TT);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function Xi(i,r){if(Rt(i.parentElement)){let t=(i.getAttribute(ai)||"").match(TT);i.setAttribute(ai,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(TV),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function on(i,r){let t=(i.getAttribute(ai)||"").match(qR);i.setAttribute(ai,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function nL(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return He(r,t,e)}function _T(i,r){let e=nL(i,r,i.r);on(i.el,e),Xi(i.el,i.r)}var zu=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[ve]:""+(n[0]||0),[De]:""+(n[1]||0)};ce(r.canvas,o),we(r.canvas,r)}}}};var cf="vjs-surface",RT="vjs-surface-direct-render",LT="vjs-surface-touch-device",wT="vjs-surface-pointer-device",df="vjs-surface-nopan",uf="vjs-surface-canvas",pf="vjs-surface-pan",wV="vjs-surface-pan-left",DV="vjs-surface-pan-top",NV="vjs-surface-pan-right",IV="vjs-surface-pan-bottom",gf="vjs-surface-pan-active",mf="vjs-surface-flash",DT="vjs-flash-vertex",Ef="vjs-surface-panning",ff="vjs-surface-element-dragging",th="vjs-element-dragging",yf="vjs-group-child-element-dragging",rh="vjs-most-recently-dragged",Dn="vjs-surface-edge-dragging",xf="vjs-edge-relocating",Yu="vjs-edge-will-relocate",NT="vjs-lasso",nh="vjs-lasso-mask",IT="vjs-lasso-mask-left",MT="vjs-lasso-mask-top",VT="vjs-lasso-mask-right",GT="vjs-lasso-mask-bottom",Xu="vjs-miniview",$T="vjs-miniview-canvas",BT="vjs-miniview-panner",FT="vjs-miniview-element",UT="vjs-miniview-group-element",bf="vjs-miniview-panning",zT="vjs-miniview-collapse",ju="vjs-miniview-collapsed",YT="vjs-miniview-click-to-center",gt="vjs-drag-select-defeat",Af="vjs-default-node",Sf="vjs-default-group",ji="vjs-connector-source-drag",Hi="vjs-connector-target-drag",XT="vjs-connector-transient-drag",jo="vjs-palette-selected-element",ih="vjs-palette-tap-mode-active",jT="vjs-palette-drag-active",HT="vjs-palette-drag-hover",kT="vjs-palette-drag-hover-cannot-drop",WT="vjs-palette-current",Hu="vjs-palette-current-shape-type",oh="vjs-drag-hover-cannot-drop",Tf="vjs-drag-original-group",mr="vjs-drag-active",Er="vjs-drag-hover",vf="vjs-source-hover",Cf="vjs-target-hover",sh="vjs-hover",ZT="vjs-transient-vertex",Pf="vjs-edge-click-entry-method";function MV(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function JT(i,r,e){iL(i,r);let t=r.connector;zu.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=UA(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[qe]:r.edge.id},a=MV(i,e);a!=null&&(t.bgPath==null?(t.bgPath=B(te,s),L(t.bgPath,i.connectorOutlineClass),qs(t.canvas,t.bgPath,0)):ce(t.bgPath,s),tf(t,t.bgPath,a,!0)),t.path==null?(t.path=B(te,s),qs(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,uS)):(t.path.parentNode!==t.canvas&&qs(t.canvas,t.path,a!=null?1:0),ce(t.path,s)),tf(t,t.path,e,!1),r.detachable&&VV(r,o,i.defaults.edgeRelocateHandleSize)}}function VV(i,r,e){if(i.detachable){let t=i.connector,n=t.internalSegments[0].x1,o=t.internalSegments[0].y1,s={width:e,height:e,transform:`translate(${r.x-e/2},${r.y-e/2})`,"pointer-events":"fill",cursor:"move"},a=Object.assign(s,{x:n,y:o});t.sourceZone==null?(t.sourceZone=B(Z,a),L(t.sourceZone,ji),t.canvas.appendChild(t.sourceZone)):ce(t.sourceZone,a);let l=t.internalSegments[t.internalSegments.length-1].x2,h=t.internalSegments[t.internalSegments.length-1].y2,d=Object.assign(s,{x:l,y:h});t.targetZone==null?(t.targetZone=B(Z,d),L(t.targetZone,Hi),t.canvas.appendChild(t.targetZone)):ce(t.targetZone,d)}}function iL(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?B(Pe,{[ve]:"0",[De]:"0",style:{"pointer-events":pt,position:st},[qe]:r.edge.id}):B(q,{[qe]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var Of=class{constructor(r,e){this.container=r;c(this,"qt",!0);c(this,"ge");c(this,"qa");c(this,"Pi");c(this,"Qa");c(this,"ke");c(this,"gu");c(this,"tt");c(this,"Qt");c(this,"er",{});c(this,"Sn",[]);c(this,"Z");c(this,"Yr");c(this,"_i");c(this,"Ri");c(this,"Li");c(this,"nl");e=e||{init:null},this.ge=new fe,this.qa=this.WE.bind(this),this.ge.on(r,pe,"*",this.qa),this.Pi=this.ZE.bind(this),this.Qa=this.JE.bind(this),this.Li=e.translate||(t=>Object.assign({},t)),this.nl=e.init}$enable(){this.qt=!0}$disable(){this.qt=!1}addHandler(r){let e=this.er[r.selector];e==null&&(this.er[r.selector]=[],e=this.er[r.selector],this.Sn.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.er[r.selector];e!=null&&(this.er[r.selector]=e.filter(t=>t!==r),this.er[r.selector].length===0&&(delete this.er[r.selector],this.Sn=this.Sn.filter(t=>t!==r.selector)))}WE(r){if(!this.qt||r.KE===!0)return;let e=!1;this.tt=r.target;let t=()=>{e||(e=!0,this.nl&&this.nl(r),this.Qt=et(this.tt),this.ke=null,this.Z=ge(r),this._i=this.Li(this.Z),this.Yr=Object.assign({},this.Z),this.Ri=Object.assign({},this._i))};for(let n=0;n<this.Sn.length;n++)if(Gt(this.tt,this.Sn[n],this.container)){let o=this.er[this.Sn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.tt,l=this.Qt;if(o[s].target){if(a=this.tt.closest(o[s].target),a==null)continue;l=et(a)}if(this.gu=o[s].start({pagePosition:this.Z,e:r,el:a,size:l,translatedPosition:this._i}),this.gu!==!1){this.tt=a,this.Qt=l,this.ke=o[s],le(r),r.KE=!0;break}}}}this.ke!=null&&(this.ge.on(document,oe,this.Pi),this.ge.on(document,se,this.Qa))}ZE(r){if(!this.qt)return;let e=ge(r),t=this.Li(e);this.ke!=null&&(this.ke.constrainFunction&&(this.ke.usesPageCoordinates?(e=this.ke.constrainFunction(e,this.tt,{width:0,height:0},this.Qt,this.Yr,r),t=this.Li(e)):t=this.ke.constrainFunction(t,this.tt,{width:0,height:0},this.Qt,this.Ri,r)),this.ke.drag({e:r,el:this.tt,pagePosition:e,size:this.Qt,originalPagePosition:this.Z,translatedPosition:t,originalTranslatedPosition:this._i}),this.Yr=e,this.Ri={x:t.x,y:t.y})}JE(r){this.Yr=ge(r),this.Ri=this.Li(this.Yr),this.ke!=null&&this.ke.stop({e:r,el:this.tt,pagePosition:this.Yr,size:this.Qt,originalPagePosition:this.Z,translatedPosition:this.Ri,originalTranslatedPosition:this._i}),this.oe()}oe(){this.ge.off(document,oe,this.Pi),this.ge.off(document,se,this.Qa),this.ke=null,this.tt=null,this.Qt=null,this.Z=null,this.Yr=null}destroy(){this.ge.off(this.container,pe,this.qa),this.oe()}};var ku={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},ah="start",lh="center",hh="end",GV="Default",$V="Default shapes",KT="vjs-shape",Wu="vjs-shape-label",ch="vjs-shape";var BV="http://www.w3.org/2000/svg",FV="http://www.w3.org/1999/xlink",UV="svg",zV="xlink",YV="html";function _f(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var Ho=class extends So{constructor(r){super(r),this.namespaceHandlers[UV]=e=>document.createElementNS(BV,e.split(":")[1]),this.namespaceHandlers[YV]=e=>document.createElement(e.split(":")[1]),this.namespaces[zV]=FV}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Pd(){return _f}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function fr(i){return new Ho(i||{})}var Zu="link",Ju="clone",Ku="trash",qT="cross",QT="plus",ev="circle",tv="gear",oL={x:0,y:0,width:32,height:32},dh={[Ju]:{id:Ju,viewBox:oL,shapes:[{tag:te,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[Zu]:{id:Zu,viewBox:oL,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:Xe,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:te,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:te,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[Ku]:{id:Ku,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:te,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:te,atts:{d:"M 12 26 L 10 8"}},{tag:te,atts:{d:"M 20 26 L 22 8"}},{tag:te,atts:{d:"M 16 26 L 16 8.5"}}]},[qT]:{id:qT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 2 2 L 30 30"}},{tag:te,atts:{d:"M 30 2 L 2 30"}}]},[QT]:{id:QT,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:te,atts:{d:"M 16 2 L 16 30"}},{tag:te,atts:{d:"M 2 16 L 30 16"}}]},[ev]:{id:ev,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:Xe,atts:{cx:16,cy:16,r:15}}]},[tv]:{id:tv,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:te,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function XV(i,r){let e=typeof i=="string"?dh[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function qu(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=B(Pe,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=B(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function Qu(i,r,e,t,n,o,s){return qu(dh[i],r,e,t,n,o,s)}var jV={x:0,y:0,width:32,height:32},HV={stroke:"currentColor",fill:"none"},Rf=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return dh[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||dh[r];if(!n){this.innerHTML="";return}let o=n.viewBox||jV,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=dn(dn({},HV),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",Rf);var kV="label",sL="transform",aL="x",lL="y",ep="origin",nv="originX",iv="originY",hL="orientation",ov="size",sv="key",cL="iconId",uh="middle",rv="type",Lf="category",av="horizontal",WV="vertical",tp="vjs-shape-icon",dL="vjs-include-icon",uL="vjs-include-icons",ZV="category",JV="type",Wi="__vjsRootSet",ki=kV,wf="fill",ph="outline",gh="outlineWidth",Df="color",mh="#FFFFFF",ko="#000000",Eh=2,lv="#000000",pL=.8,ra=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",fr({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${tp}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||JV,this.categoryParameter=e.categoryParameter||ZV,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||pL,this.labelPosition=e.labelPosition||"center",this.qE(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:xe,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.QE(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||ki)}qE(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=ms(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,Wi),parent:null,id:Wi,name:Wi,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.ef()):t.template}getCompiledShape(r,e){let t=this.tf(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}rf(r){r.setAttribute&&r.setAttribute(bu,Au),r.hasChildNodes&&r.childNodes.forEach(e=>this.rf(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||ki;let l=B(Qe,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":uh,"dominant-baseline":uh,class:Wu,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}tf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}nf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:uh,dominantBaseline:uh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:uh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:uh,dominantBaseline:"auto"}}[r]}of(r,e,t=ki){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:g,y:m,transform:E,textAnchor:y,dominantBaseline:x}=this.nf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Mu}>${s.template}</svg:g><svg:g ${Vu}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${g}" y="${m}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${Wu}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${xe}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=ki,s=mh,a=ko,l=ko,h=Eh){return e=e||h,{template:r?`<svg:g class="${ch}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
-
<r-fragment key="${
|
|
6
|
-
</svg:g>`:`<svg:svg class="${
|
|
7
|
-
<r-fragment key="${
|
|
8
|
-
</svg:svg>`,fragments:{[`${
|
|
4
|
+
`;return e+="]}",e}isChildOf(e){return!1}},Jm=class Jm extends vc{constructor(e,t,n){super(e,t,n);c(this,"objectType",Jm.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new ce(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=Sc(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=Sc(e),o=Sc(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=Sc(e),a=Sc(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(Jm,"objectType","Node");var le=Jm,Km=class Km extends vc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",Km.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(Km,"objectType","Port");var ce=Km,qm=class qm extends le{constructor(e,t,n){super(e,t,n);c(this,"objectType",qm.objectType);c(this,"members",[]);c(this,"Vo",{})}$addMember(e){return this.Vo[e.id]!=null?!1:(this.members.push(e),this.Vo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Vo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Vo[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(qm,"objectType","Group");var ie=qm,Qm=class Qm extends Tc{constructor(e){super(e.graph,e.data);c(this,"objectType",Qm.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(Qm,"objectType","Edge");var Ue=Qm;var Fx="undoRedo",po="userActivity",ol="api",sl="dataLoad",Ux="transient",Yx="copyPaste";var mN=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let m=l.get(p);m!=null&&m.forEach(g=>{h.push(r.addGroup(g).id)}),l.delete(p),m!=null&&m.forEach(g=>{d(g.id)})};for(let p=0;p<o.length;p++){let m=o[p];if(e.groupDecorator&&e.groupDecorator(m),m.group!=null&&h.indexOf(m.group)===-1)fs(l,m.group,()=>[]).push(m);else{let g=r.addGroup(m);a.set(g.id,m),h.push(g.id),d(g.id)}}l.forEach((p,m)=>{if(h.indexOf(m)===-1)throw new Error("Parent group ["+m+"] not found");p.forEach(g=>h.push(r.addGroup(g).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let m=r.addNode(t[p]);s.set(m.id,t[p])}function u(p){return X(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let m=n[p].data||{},g={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:m};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(m,E,y)}n[p].anchors&&(g.anchors=n[p].anchors),n[p].geometry&&(g.geometry=n[p].geometry),r.$_addEdge(g,sl,null)}},gN=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h.group,t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===ce.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l.group,t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===ce.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},EN=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},sl,null),t(n.children[s])}};t(i)},Ht="json",og="hierarchical-json",eO={[Ht]:gN},tO={[Ht]:mN,[og]:EN};function zx(i,r){tO[i]=r}function fN(i,r){eO[i]=r}function Xx(i,r,e,t){let n=tO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function sg(i,r,e){let t=eO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var ag=class{constructor(){c(this,"ze",{});c(this,"ca",!1);c(this,"da",!1);c(this,"Vg",{ready:!0});c(this,"Cc",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.da)this.Cc.unshift(arguments);else{if(this.da=!0,!this.ca&&this.ze[r]){let o=this.ze[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.Vg[r])this.ze[r][s](e,t);else try{n=this.ze[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.ze==null||this.ze[r]==null)&&(a=!0)}}this.da=!1,this.Gg()}return n}Gg(){let r=this.Cc.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.ze={};else if(arguments.length===1){if(typeof r=="string")delete this.ze[r];else if(r.ri){let t;for(let n in r.ri)t=r.ri[n],Xm(this.ze[t]||[],r)}}else arguments.length===2&&Xm(this.ze[r]||[],e);return this}getListener(r){return this.ze[r]||[]}isSuspendEvents(){return this.ca}setSuspendEvents(r){this.ca=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{Ox(this.ze,o,e,t),e.ri=e.ri||{},e.ri[$()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},Gt=class extends ag{shouldFireEvent(r,e,t){return!0}};var al=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"Pc",[]);c(this,"hn",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.Pc.push(this.result.path[t].vertex),this.hn[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==ce.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.Pc}getVertex(r){return this.hn[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.hn[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}Ye(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.Ye((e,t)=>{r(e,t)})}eachVertex(r){this.Ye((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.Ye((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.Ye((e,t)=>{K(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.Ye((e,t)=>{Y(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var Pc=class{constructor(r,e){c(this,"Oc",new Map);c(this,"_c",new Map);c(this,"Rc",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Oc.set(s,t[s]);let n=e.groups||{};for(let s in n)this._c.set(s,n[s]);let o=e.ports||{};for(let s in o)this.Rc.set(s,o[s])}}getNodeDefinition(r){return this.Oc.get(r)||{}}getGroupDefinition(r){return this._c.get(r)||{}}getPortDefinition(r){return this.Rc.get(r)||{}}};var fn=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"ni");this.ni=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}ii(){this.done=!1,this.$vertices.length=0,this.reset()}static $g(){return{padding:{x:0,y:0}}}Bg(){let r=Object.assign(i.$g(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return ys(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}Fg(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}Lc(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.Bg();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,m,g)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,m),s=Math.min(s,g),a=Math.max(a,m+E.width),l=Math.max(l,g+E.height),t[p]={x:m,y:g}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(m=>p[m.id]=t[m.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.ii(),r!=null&&(this.parameters=r),this.Lc(e)}layout(r){this.done=!1,this.Lc(r)}};var _c=class{};var rO={},nt={get:(i,r)=>{let e=rO[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{rO[i]=r}};var lg=class lg extends fn{constructor(e){super(e);c(this,"type",lg.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(lg,"type","Empty");var bs=lg;nt.register(bs.type,bs);function yN(i){return{x:i.data.left,y:i.data.top}}var Zn=class extends fn{constructor(e){super(e);c(this,"wc");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.wc=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.wc||yN)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},nO="Absolute",hg=class hg extends Zn{constructor(e){super(e);c(this,"type",hg.type)}getDefaultParameters(){return{}}};c(hg,"type",nO);var mo=hg;nt.register(mo.type,mo);function xN(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var cg=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],dg=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],iO=[null,[cg[0],dg[1]],[cg[0],dg[0]],[cg[1],dg[0]],[cg[1],dg[1]]],bN=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return xN(r,"x","width",s)?(l=iO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=iO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function _i(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Dr(e,t),o=ms(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return bN(i,r,n,s,o)}function Pi(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function oO(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var AN={x:20,y:20},SN=1/0;function sO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=ae(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Oi=class{constructor(r){c(this,"De");c(this,"H");c(this,"ua");c(this,"dt");c(this,"Dc");c(this,"Ir",null);c(this,"cn");c(this,"k");c(this,"dn");c(this,"Nc");c(this,"W",[]);c(this,"ae",new Map);c(this,"Go",new Map);c(this,"un",new Map);c(this,"pn",new Set);c(this,"$o",!1);c(this,"Ic");c(this,"Ct",new Map);this.dn=r.positionGetter,this.Nc=r.positionSetter,this.k=r.getId,this.cn=r.getSize,this.H=oO(r.elements||[]),this.dt=r.filter||(e=>!0),this.Dc=r.exclude||(e=>!1),this.ua=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.H.length>0?(this.oi((e==null?void 0:e.getSize)||this.cn,(e==null?void 0:e.getPosition)||this.dn,e==null?void 0:e.knownLocations),this.pa(r),this.Ir=null,this.ma(e)):{original:{},current:{}}}executeAtCenter(r){if(this.H.length>0){let e=this.oi((r==null?void 0:r.getSize)||this.cn,(r==null?void 0:r.getPosition)||this.dn,r==null?void 0:r.knownLocations);return this.pa({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Ir=null,this.ma(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.H.length>0?(this.oi((e==null?void 0:e.getSize)||this.cn,(e==null?void 0:e.getPosition)||this.dn,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Ir={id:r,bounds:this.ae.get(r),element:this.H.find(t=>t.id===r)},this.pa(this.Ir.bounds.center),this.ma(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.oi(this.cn,this.dn);for(let t=0;t<this.W.length;t++){let n=this.ae.get(this.W[t].id),{moved:o,pos:s}=sO(this.W[t].bounds,r);o&&(e.original[this.W[t].id]=n,e.current[this.W[t].id]=s)}return this.Mc(e),e}setElements(r){return this.H=oO(r),this}startTracking(r,e,t){return this.setElements(r),this.oi(this.cn,this.dn),this.Ic=t||SN,this.un.clear(),this.pn.clear(),this.Go.entries().forEach(n=>{this.un.set(n[0],Object.assign({},n[1]))}),this.$o=e,this}stopTracking(){this.un.clear(),this.pn.clear(),this.$o=!1}addElement(r,e){return r!=null&&(e||this.H.indexOf(r)===-1)&&this.H.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.H,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.H.length;t++)if(this.H[t]===r){e=t;break}return e!==-1&&this.H.splice(e,1),this}reset(){this.H.length=0}pa(r){r!=null&&(this.De=r)}oi(r,e,t,n){return this.W.length=0,this.ae.clear(),this.Go.clear(),this.Ct.clear(),this.Ug(this.H,r,e,t,n)}Ug(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),m=this.k(r[d]),g={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.ae.set(m,g),this.Go.set(m,Object.assign({},g)),this.W.push({bounds:g,id:m,element:r[d]}),this.Ct.set(m,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}zg(r,e,t,n){if(this.un.has(r)){let o=this.un.get(r),s=this.ae.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Fe(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.Ic)return null;let p=null,m=0;for(let g=1;g<d;g++){let E={x:a.x+g*h*Math.cos(u),y:a.y+g*h*Math.sin(u)},y=Pi(E,o,{x:0,y:0});sO(y,n);let x=!0;for(let f=0;f<this.W.length;f++){let b=this.W[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=Pi(A.center,A,e);if(tt(y,T)){x=!1;break}}}if(x)m=g,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:m===d-1,positionReached:p}:null}else return null}Yg(r={},e,t,n,o){if((this.$o&&!o||!this.$o&&o)&&this.pn.size>0){let a=!1;for(;!a;){let l=!0;this.pn.forEach(h=>{let d=this.zg(h,e,t,n);if(d!=null&&d.moved){let u=this.un.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let m=this.ae.get(h);m.x=p.x,m.y=p.y,m.center.x=p.x+u.width/2,m.center.y=p.y+u.height/2,d.reverted&&this.pn.delete(h),l=!1}}),a=l}}}ma(r){let e={};if(this.H.length>1){r=r||{};let n=r.filter||this.dt,o=r.padding||AN,s=r.iterations,a=r.exclude||this.Dc;r.gather&&Object.assign(e,this.Xg(o,this.ua,n,a)),Object.assign(e,this.jg(o,this.ua,n,s,a,r.grid)),this.Yg(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.Go.get(n),t.current[n]=e[n],this.pn.add(n);return this.Mc(t),t}Xg(r,e,t,n){let o={},s=Pi(this.De,{width:0,height:0},r);this.Vc();let a={},l=h=>{let d=[this.De,h],u=[];Array.prototype.push.apply(u,sr(d,s).map(p=>[s,p,null]));for(let p in a){let m=this.ae.get(p);Array.prototype.push.apply(u,sr(d,m).map(g=>[m,g,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.W.length;h++){if(n(this.W[h].id,this.W[h].element))continue;let d=this.W[h].bounds,u=this.W[h].bounds,p=Pi(d.center,u,r);if(t(this.W[h].id,this.W[h].element)){let m=l(d.center);if(m.length>0){m.sort((y,x)=>{let f=Fe(y[1],d),b=Fe(x[1],d);return f<b?-1:1});let g=m[0][0],E=_i(g,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.W[h].id]=d,a[this.W[h].id]=!0}}}return o}jg(r,e,t,n,o,s){n=n||2;let a,l;this.Ir!=null?(a=Pi(this.De,this.Ir.bounds,{x:0,y:0}),l=this.Ir.id):a=Pi(this.De,{width:0,height:0},r),this.Vc();let h=1,d=!0,u,p,m={},g=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,m[x]=f},E=(x,f)=>{if(s==null)return f;{let b=Ti(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),R=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*R};return bx(v,x)}},y=()=>{let x,f;for(let b=0;b<this.W.length;b++){if(x=this.W[b],o(x.id,x.element))continue;let A=x.bounds,T=Pi(A.center,A,r);x.id!==l&&t(x.id,x.element)&&tt(a,T)&&(u=_i(a,T),u=E(A,u),p=e(x.id,A,u),g(x.id,A,p.x,p.y),T=Pi(A.center,A,r));for(let S=0;S<this.W.length;S++)if(b!==S){if(f=this.W[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let R=f.bounds,v=Pi(R.center,R,r);tt(T,v)&&(d=!0,u=_i(T,v),u=E(R,u),p=e(f.id,R,u),g(f.id,R,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),m}Mc(r){for(let e=0;e<this.H.length;e++){let t=this.k(this.H[e]);r.current[t]&&this.Nc(this.H[e],r.current[t])}}Vc(){let r={};this.W.sort((e,t)=>{let n=r[e.id]||Math.min(Fe(e.bounds,this.De),Fe(Ti(e.bounds,{x:e.bounds.width,y:0}),this.De),Fe(Ti(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.De),Fe(Ti(e.bounds,{x:0,y:e.bounds.height}),this.De)),o=r[t.id]||Math.min(Fe(t.bounds,this.De),Fe(Ti(t.bounds,{x:t.bounds.width,y:0}),this.De),Fe(Ti(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.De),Fe(Ti(t.bounds,{x:0,y:t.bounds.height}),this.De));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var aO={x:30,y:30},ug=class ug extends fn{constructor(e){super(e);c(this,"Gc");c(this,"type",ug.type);c(this,"padding",aO);this.Gc=e.options.centerRoot===!0,this.padding=e.options.padding||aO}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ni}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.Gc&&a.length>0){let E=this.getSize(a[0].id,o);p=Math.max(E.width,E.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let m=2*Math.PI/a.length,g=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m,d>0){let E=a[d-1],y=this.getSize(E.id,o),x=t(E.id),f={x:x.x-s.padding.x,y:x.y-s.padding.y,width:y.width+2*s.padding.x,height:y.height+2*s.padding.y},b=a[d],A=this.getSize(b.id,o),T=t(b.id),S={x:T.x-s.padding.x,y:T.y-s.padding.y,width:A.width+2*s.padding.x,height:A.height+2*s.padding.y},R=_i(f,S),v=[x.x+y.width/2,x.y+y.height/2],_=[T.x+R.x+A.width/2,T.y+R.y+ +(A.height/2)],P=Math.sqrt(Math.pow(v[0]-_[0],2)+Math.pow(v[1]-_[1],2));p=Math.max(p,P/2/Math.sin(m/2))}for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(g)*p,h+Math.cos(g)*p),g+=m;this.done=!0}};c(ug,"type","Circular");var Oc=ug;nt.register(Oc.type,Oc);var pg="Grid",mg="Column",gg="Row";var ve="width",Ne="height",TN="rotation",Rc="v",jx="h",Se="top",je="left",ft="right",ht="bottom",It="center",Q="x",Ee="y",yn="dlr",Jn="drl",qr="none",Qr="orthogonal",Hx="manhattan",Lc="diagonal",kx="metro",Wx=-1,ue="v",re="h",Zx="undefined",xe="default",vt="true",ct="false",Jx="left",Kx="top",qx="rotation",Qx="width",eb="height",it="source",xn="target";var vN={x:30,y:30},Ri="row",tb="column",go=class extends fn{constructor(e){super(e);c(this,"mn",[]);c(this,"ga");c(this,"Ea");c(this,"pe");c(this,"gn");c(this,"En");c(this,"Mr");c(this,"Vr");c(this,"fa");c(this,"type");this.type=pg,this.pe=e.options.orientation||Ri,this.padding=e.options.padding||vN,this.ga=e.options.verticalAlignment||It,this.Ea=e.options.horizontalAlignment||It,this.gn=e.options.rows||-1,this.En=e.options.columns||-1,this.fa=e.options.sort}getDefaultParameters(){return{orientation:Ri,rows:-1,columns:-1}}begin(e,t,n,o,s){this.mn.length=0;let a,l;if(this.fa!=null){let p=this.$vertices.slice();p.sort(this.fa),this.$vertices=p}if(this.gn===-1&&this.En===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.pe===Ri?1:0),l=p+(this.pe===tb?1:0)}else this.gn!==-1?(a=this.gn,l=Math.ceil(this.$vertices.length/a)):this.En!==-1&&(l=this.En,a=Math.ceil(this.$vertices.length/l));this.Mr=-1/0,this.Vr=-1/0;let h=0,[d,u]=this.pe===Ri?[a,l]:[l,a];for(let p=0;p<d;p++){this.mn[p]=[];for(let m=0;m<u;m++)if(h=p*u+m,h<this.$vertices.length){let g=this.$vertices[h],E=this.getSize(g.id,o);this.Mr=Math.max(this.Mr,E.width),this.Vr=Math.max(this.Vr,E.height),this.mn[p][m]={vertex:g,size:E}}}}end(e,t,n,o,s){}reset(){}Hg(e){let t=this.pe===Ri&&this.gn===1||this.Ea===je?0:this.Ea===It?(this.Mr-e.width)/2:this.Mr-e.width,n=this.pe===tb&&this.En===1||this.ga===Se?0:this.ga===It?(this.Vr-e.height)/2:this.Vr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.mn.length;h++){for(let d=0;d<this.mn[h].length;d++){let u=this.mn[h][d],{padX:p,padY:m}=this.Hg(u.size);n(u.vertex.id,a+p,l+m),this.pe===Ri?a+=this.padding.x*2+(this.gn===1?u.size.width:this.Mr):l+=this.padding.y*2+(this.En===1?u.size.height:this.Vr)}this.pe===Ri?(l+=this.padding.y*2+this.Vr,a=0):(a+=this.padding.x*2+this.Mr,l=0)}this.done=!0}};c(go,"type",pg),nt.register(go.type,go);var ll=class extends go{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:tb,columns:1})})),this.type=mg}};c(ll,"type",mg),nt.register(ll.type,ll);var hl=class extends go{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:Ri,rows:1})})),this.type=gg}};c(hl,"type",gg),nt.register(hl.type,hl);var lO=1e-11,Eg=class Eg extends Zn{constructor(e){super(e);c(this,"Bo");c(this,"type",Eg.type);c(this,"H",new Map);c(this,"si",new Map);c(this,"ai");c(this,"Pt");c(this,"Fo",1/0);c(this,"Uo",-1/0);c(this,"zo",1/0);c(this,"Yo",-1/0);c(this,"Ot",[]);c(this,"ya",new Map);c(this,"_t");c(this,"xa");this._t=gn(this.getDefaultParameters(),e.options),this.Pt=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.ni}}yn(e,t,n){return t=Um(t),n=Um(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{kg:t,Wg:n}}xn(e){return this.si.get(e.id)===!0}Zg(e){this.si.set(e.id,!0)}reset(){super.reset(),this.H.clear(),this.si.clear(),this.Bo=0,this.Fo=this.zo=1/0,this.Uo=this.Yo=-1/0,this.ya.clear()}begin(e,t,n,o,s){this.Ot.length=0,this.H.clear(),this.Bo=0,this.Fo=1/0,this.Uo=-1/0,this.zo=1/0,this.Yo=-1/0,this.xa=this._t.r,this.Pt&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}ut(e,t,n){let o=H(e)?e.getParent():e,s=this.H.get(o.id);if(!s){let a=t(o.id)||this.Fg(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.H.set(o.id,s),this.ya.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}ba(e,t,n){return this.Ot[e]?this.Ot[e]:(this.Ot[e]=this.ut(this.$vertices[e],t,n),this.Ot[e])}step(e,t,n,o,s){let a;for(this.ai=0,a=0;a<this.$vertices.length;a++){let l=this.ba(a,t,o);if(this.Pt&&!this.xn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.$c(l,d.x,d.y),n(l.id,d.x,d.y),this.Zg(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this.ba(d,t,o);this.Jg(l,u)}let h=this.ya.get(l.id);for(let d=0;d<h.length;d++)this.Kg(l,h[d],t,o)}if(this.ai!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this.ba(a,t,o);if(!this.xn(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.$c(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.Bo++,(this.ai===0||this.Bo>=this._t.iterations)&&(this.qg(n,o),this.done=!0)}end(e,t,n,o,s){this.si.clear(),this.H.forEach((a,l)=>{this.si.set(l,!0)})}$c(e,t,n){let{kg:o,Wg:s}=this.yn(e,t,n);this.Fo=Math.min(this.Fo,o),this.zo=Math.min(this.zo,s),this.Uo=Math.max(this.Uo,o),this.Yo=Math.max(this.Yo,s)}qg(e,t){this.H.forEach((n,o)=>{let s=this.H.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}Jg(e,t){let n=this.xn(e),o=this.xn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(tt(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=sr(d,e)[0],p=sr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<lO&&(h=1,s=1,a=1)}if(h<this._t.spacing){this.ai++;let d=this.xa*(this._t.spacing-h),u=1,p=1,m=u*d*s/h,g=p*d*a/h,E=o?0:(n?2:1)*m,y=o?0:(n?2:1)*g,x=n?0:(o?2:1)*m,f=n?0:(o?2:1)*g;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}Kg(e,t,n,o){let s=this.ut(t.target,n,o),a=this.xn(e),l=this.xn(s);if(a&&l)return;this.ai++;let h,d,u,p,m;if(tt(e,s))p=-2*this._t.spacing,h=-2*this._t.spacing,d=-2*this._t.spacing;else{let y=[e.center,s.center],x=sr(y,e)[0],f=sr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<lO&&(p=1,h=1,d=1)}m=this.xa*(p-this._t.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),m*=Math.log(t.cost)*.5+1;let g=m*h/p,E=m*d/p;s.f[0]-=l?0:(a?2:1)*g,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*g,e.f[1]+=a?0:(l?2:1)*E}};c(Eg,"type","ForceDirected");var wc=Eg;nt.register(wc.type,wc);function CN(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var As=class extends Zn{constructor(e){super(e);c(this,"Bc");c(this,"bn");c(this,"Fc");this.Bc=!!e.options.ignoreLoops,this.Fc=e.options.ignorePorts===!0,this.bn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(Gx(n)){let o=n.getTargetEdges();return(o.length===0||CN(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.Bc,s.getRootNode=this.bn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=H(u.target)?u.target.getParent():u.target;(u.source===a||this.Fc!==!0&&H(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var rb=It,nb={x:60,y:60},ib="auto",ob=It;function Dc(i){return i.parents.length>0?i.parents[0].loc:null}function fg(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function PN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function hO(i){return i.parents.length>0?i.parents[0].childGroup:null}function _N(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Nc=class{constructor(r,e){this.dataSource=r;c(this,"Gr");c(this,"Zt");c(this,"Ce");c(this,"L",[]);c(this,"$r",[]);c(this,"li",{});c(this,"te");c(this,"q");c(this,"Rt");c(this,"me");c(this,"hi");c(this,"Ae");c(this,"Pt");c(this,"I");c(this,"An",-1/0);c(this,"Sn",1/0);c(this,"ci");c(this,"Lt");c(this,"di");c(this,"Ne",[]);c(this,"positions",new Map);c(this,"Aa",{[It]:r=>Dc(r)+fg(r,this.q)/2-(r.size-this.q)/2,start:r=>Dc(r),end:r=>Dc(r)+fg(r,0)-(r.size-this.q)});c(this,"k");c(this,"wt");c(this,"Jt");c(this,"pi");c(this,"Oa",{center:(r,e,t)=>(e+t)/2-fg(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Gr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Zt=e.compress===!0,this.Pt=e.absoluteBacked===!0,this.k=e.idFunction,this.wt=e.sizeFunction,this.Jt=e.childVerticesFunction,this.pi=e.absolutePositionFunction,this.me=e.axisIndex,this.Ae=this.me!==1,this.hi=this.me===0?1:0,this.ci=this.Ae?"y":"x",this.Lt=this.Ae?ve:Ne,this.di=this.Ae?Ne:ve,this.Ce=e.invert===!0,this.I=e.alignment||ob,this.te=e.padding,this.q=this.Ae?this.te.x:this.te.y,this.Rt=this.Ae?this.te.y:this.te.x}execute(){let r,e,t;for(let n=0;n<this.Gr.length;n++){r=this.Gr[n];let o=this.wt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.mi(s,0);let l=0,h,d,u=(m,g)=>this.Zt&&m.parents&&m.parents.length>0?this.positions.get(this.k(m.parents[0].node)).position[this.ci]+this.Sa(m,this.hi)+this.Rt:g,p=!1;if(a===0&&this.Pt===!0){let m=this.pi(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.gi(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.me===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.me===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.gi(this.k(this.L[e].entries[t].node),{x:h,y:d},e);this.Ce?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Rt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Rt,l+=this.L[e].otherAxisSize)}}return this.positions}gi(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.wt(r),o=this.me===0?e.x+n.width:e.y+n.height;this.An=Math.max(this.An,o),this.Sn=Math.min(this.Sn,o)}ut(r){let e=this.L[r];return e||(e={entries:[],pointer:0},this.L[r]=e),e}Qe(r,e,t,n,o){let s=this.ut(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Lt],children:[]},l=e[this.di];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Lt]+this.q,s.entries.push(a),n&&n.children.push(a),a}Ta(r,e){let t=this.$r[e];t||(t=[],this.$r[e]=t),r.index=t.length,t.push(r)}va(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.ut(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.q)}}Sa(r,e){let t=r.parents.map(n=>n.dimensions[e===0?ve:Ne]);return Math.max.apply(null,t)}Ca(r){if(r.size>0){let e=this.Aa[this.I](r),t=this.$r[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.q}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.q;o!==0&&this.Pa(r),this.Ta(r,r.depth)}}_a(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Oa[this.I](r,e,t),o=n-Dc(r);if(this.va(r,n),!PN(r)){let s=hO(r),a=_N(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Pa(r){let e=r;for(;e!=null;)this._a(e),e=hO(e)}mi(r,e){if(this.li[r.node.id])return;this.li[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.ut(e+1),l=this.Jt(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.wt(this.k(h)),u=a.entries.find(p=>this.k(p.node)===this.k(h));if(u!=null){u.parents.push(r);let p=Dc(u),m=fg(u,this.q),g=p+m/2-u.size/2,E=g-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.Qe(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let m=d[this.Lt];t.size+=m+this.q,n.push(p)}s[h.id]=!0}}for(this.Ca(t),o=0;o<n.length;o++)this.mi(n[o],e+1);return l.length}};var cO="Hierarchical",yg=class yg extends As{constructor(e){super(e);c(this,"type",yg.type);c(this,"pe");c(this,"Ae");c(this,"me");c(this,"Zt");c(this,"Ce");c(this,"I");c(this,"Uc");c(this,"L",[]);c(this,"Jt");this.Ce=e.options.invert,this.Uc=e.options.spacing||ib,this.Zt=this.Uc==="compress",this.I=e.options.align||rb,this.pe=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:nb,orientation:this.pe,locationFunction:this.ni,align:this.I}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.pe=s.orientation,this.Ae=this.pe==="horizontal",this.me=this.Ae?0:1,this.padding=s.padding,this.L.length=0,this.Jt=s.getChildVertices}step(e,t,n,o,s){new Nc(e,{rootNode:s.rootNode,compress:this.Zt,padding:this.padding,axisIndex:this.me,invert:this.Ce,alignment:this.I,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Jt(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.L}getOrientation(){return this.pe}};c(yg,"type",cO);var Ic=yg;nt.register(Ic.type,Ic);var xg=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"ae",new Map);c(this,"zc",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=$(),this.group=[r]}setPosition(r,e,t){this.ae.set(r,{x:e,y:t})}getPosition(r){return this.ae.get(r)}getIncidentAngle(r){return this.zc.get(r)}setIncidentAngle(r,e){this.zc.set(r,e)}getPositions(){return this.ae}},ON=100,RN={x:50,y:50},bg=class bg extends As{constructor(e){super(e);c(this,"type",bg.type);c(this,"Yc");c(this,"et",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||ON,this.padding=e.options.padding||RN,this.clusterMagnetizer=new Oi({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.et[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ni,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.et.length=0,this.Yc=s.getChildEdges}Xc(e,t,n,o,s,a,l){let h=(T,S,R,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:R+2*a.padding.x,height:v+2*a.padding.y}),d,u=new xg(e),p=s?s.position:{x:0,y:0},m=p.x,g=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.Yc(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,R=H(S)?S.getParent():S;u.children.add(R)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(m-x.width/2,g-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.et.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,R=S,v=null;u.children.forEach(N=>{f=y(N.id);let M=h(m+Math.sin(S)*f.width,g+Math.cos(S)*f.height,f.width,f.height),D=_i(b,M),V=Math.sqrt(Math.pow(M.x+D.x-m,2)+Math.pow(M.y+D.y-g,2));if(d=Math.max(d,V),u.setPosition(N.id,M.x+D.x,M.y+D.y),S+=T,v!=null){let J=y(v.id),ye=u.getPosition(v.id),j=h(ye.x,ye.y,J.width,J.height),ge=y(N.id),Be=u.getPosition(N.id),ke=h(Be.x,Be.y,ge.width,ge.height),zt=_i(j,ke),or={x:ye.x+J.width/2,y:ye.y+J.height/2},tr={x:Be.x+zt.x+ge.width/2,y:Be.y+zt.y+ +(ge.height/2)},wr=Math.sqrt(Math.pow(or.x-tr.x,2)+Math.pow(or.y-tr.y,2));d=Math.max(d,wr/2/Math.sin(T/2))}v=N}),S=R,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,m+Math.sin(S)*d,g+Math.cos(S)*d),S+=T});let _=u.getPosition(e.id),P=_.x,I=y(e.id),C=P+I.width,O=_.y,w=O+I.height,B;u.children.forEach(N=>{if(!this.Xc(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){B=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+B.width),O=Math.min(O,D.y),w=Math.max(w,D.y+B.height)}}),u.extents=[P,C,O,w],u.offsets={};for(let N=0;N<u.group.length;N++){let M=u.group[N],D=u.getPosition(M.id);u.offsets[M.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.Xc(s.rootNode[0],t,n,o,null,s,0),this.et.length>0){let a=(this.et[0].extents[0]+this.et[0].extents[1])/2,l=(this.et[0].extents[2]+this.et[0].extents[3])/2;this.clusterMagnetizer.setElements(this.et),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.et.length;a++)this.et[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(bg,"type","Balloon");var Mc=bg;nt.register(Mc.type,Mc);var Ss=class{constructor(r){this.model=r}};var vr="edge",cl="vertex",Vc="center",Ag=30;function dt(i){return i.type===vr}var Gc=class extends Ss{constructor(e,t){super(e);this.vertexSet=t;c(this,"Kt",new Map);c(this,"Xo",!1);c(this,"qt");c(this,"Br",[]);c(this,"jc",new Set);c(this,"Ei");this.Ei=e.layout.Ei}Qg(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.Kt.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}Hc(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.jc.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.Kt.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.Qg(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.Kt.has(p.id));if(u.length>0){let p=Math.max(...u.map(m=>this.vertexSet.findLayerIndex(m.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let m={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:vr,entries:[]};this.vertexSet.edgeNodes.push(m),this.vertexSet.edgeNodeMap.set(p.id,m)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:vr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Br.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.Kt.set(s[a].id,!0),this.Hc(s[a],t+1)}eE(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.Kt.clear(),this.Xo=!1,this.qt=0,this.Br.length=0,this.Kt.set(e.id,!0);!this.Xo;)if(this.Hc(e,this.qt),this.Br.length>0)if(this.Br=this.Br.filter(t=>!this.Kt.has(t[0].id)),this.Br.length>0){let t=this.Br.splice(0,1)[0];e=t[0],this.qt=t[1],this.Kt.set(e.id,!0),this.vertexSet.addToLayer(this.qt,e)}else this.Xo=!0;else this.Xo=!0;this.Ei&&this.tE(),this.eE()}tE(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.jc)}};var sb=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function LN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var Ts=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"fi");c(this,"yi");t=t||{},this.fi=t.maxIterations||24,this.yi=t.maxIterationsWithoutImprovement||5}rE(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.rE(),e=r,t=0,n=this.kc(r),o=sb(e);for(let s=0;s<this.fi;s++){let a=this.nE(s,e),l=this.kc(a);if(l.total<n.total)n=l,t=0,o=sb(a);else if(l.total===n.total){let h=sb(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.yi)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}kc(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.iE(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}iE(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,m=this.getAdjacentEntries(e,t,u),g=[];for(let E=0;E<m.length;E++){let y=m[E][1];g.push(y)}g.sort(function(E,y){return E-y}),l[p]=g}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let m=u[1]+1;m<a.length;m++)n.push(...a[m])}return n}nE(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.Wc(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.Wc(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}Wc(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(g=>!dt(g[0])),m=u.filter(g=>dt(g[0]));m.length>0&&(m.sort((g,E)=>g[0].obj.span>E[0].obj.span?-1:E[0].obj.span>g[0].obj.span?1:0),p.push(m[0])),u.length>0?s.push([d,LN(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===cl&&u[0].type===cl?0:d[0].type===vr&&u[0].leaf?-1:u[0].type===vr&&d[0].leaf?1:0),s.map(d=>d[0])}};var dO="xmax",uO="ymax",pO="xmin",mO="ymin",Sg="_min",Tg="_max",$c=class{constructor(r,e,t,n,o){this.D=r;this.he=e;this.axis=t;this.Ce=n;this.oE=o;c(this,"xi",{})}execute(){this.xi={};let r=this.oE(),e={},t=this.axis===0?{[Sg]:pO,[Tg]:dO}:{[Sg]:mO,[Tg]:uO},n=this.axis===1?{[Sg]:pO,[Tg]:dO}:{[Sg]:mO,[Tg]:uO},o=null;for(let a=0;a<this.he.layers.length-1;a++){let l=this.he.layers[a],h=this.he.layers[a+1],d=Math.min(l[t.Se],h[t.Se]),p=Math.max(l[t.Dt],h[t.Dt])-d,m=this.Ce?n.Se:n.Dt,g=this.Ce?n.Dt:n.Se,E=l[m],x=h[g]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.he.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.he.regions.push(S),this.xi[A.id]=S;let R=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,_=this.axis===0?f.top:f.left;if(v<_){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:_-v,height:this.axis===0?_-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.he.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.jo(A,T,S,P,!0),R=P}}S.gateDown=this.jo(A,T,R,f,!0),o!=null&&(S.gateUp=this.jo(A,T,o,S,!1))}o=f}let s=this.he.layers[this.he.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.he.regions.push(d),this.xi[l.id]=d,o!=null&&(d.gateUp=this.jo(l,h,o,d,!1))}return this.he.edgeNodes.forEach(a=>{let l=a.edge,h=H(l.source)?l.source.getParent():l.source,d=H(l.target)?l.target.getParent():l.target,u=this.D.entryMap[h.id],p=this.D.entryMap[d.id],m=this.xi[u.id],g=this.xi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.he.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.he.gateMap[T])}E.push(g.gateUp)}else{E.push(m.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.he.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.he.gateMap[T])}g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.he.edgeRoutingMap[l.id]=x,this.he.edgeRouting.push(x),e[l.id]=E}),e}jo(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.Ce?l+(o?0:h):l+(o?h:0);return this.sE(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}sE(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.he.gates.push(l),this.he.gateMap[l.id]=l,l}};function wN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,m)=>{let g=Wn(p.source),y={edge:p,isSource:g===m,sourceVertex:g,targetVertex:Wn(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(m=>{(Xe(m.source,i)&&!Xe(m.target,i)||Xe(m.target,i)&&!Xe(m.source,i))&&u(m,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let m=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[m]||(o[m]={id:m,edges:new Set},e.push(o[m])),o[m].edges.add(h[p].edge),h[p].isSource?(s[m]||(s[m]={id:m,edges:new Set},t.push(s[m])),s[m].edges.add(h[p].edge)):(a[m]||(a[m]={id:m,edges:new Set},n.push(a[m])),a[m].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function DN(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Bc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"te");c(this,"hn",{});c(this,"Ct",{});c(this,"Ho",null);c(this,"Zc",[]);c(this,"Jc",new Map);c(this,"Ra");c(this,"Ie");c(this,"bi");c(this,"Ai",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"Kc");c(this,"adjacentVertices",{});this.te=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.Kc=e.setPosition,this.Ra=e.getSize,this.Ho=e.rootNode,this.Ie=e.edgeNodeSize,this.bi=e.edgeFilter}nextRoot(){let r=this.Ai.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.hn[r]}setRootNode(r){this.Ho=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.Ct[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}qc(){let r={width:50,height:50};return this.axis===0?r.width=this.Ie:r.height=this.Ie,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.te.x:this.te.y}getPaddingInOtherAxis(){return this.axis===0?this.te.x:this.te.y}initialize(){this.Ai.length=0,this.Zc.length=0,this.Jc.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this.Ct[e.id]=this.Ra(e.id),this.hn[e.id]=e;let n=wN(e,this.bi);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:DN(n),size:this.Ra(e.id),type:cl,layer:-1,vertexSet:null};this.Ai.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.Zc.push(o),this.Jc.set(e.id,o))}this.Ai.sort((t,n)=>{let o=this.Ho?this.Ho.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.Ai.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function Fc(i){return i.parents.length>0?i.parents[0].loc:null}function vg(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function NN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function gO(i){return i.parents.length>0?i.parents[0].childGroup:null}function IN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Uc=class{constructor(r,e){this.model=r;c(this,"An",-1/0);c(this,"Sn",1/0);c(this,"Gr");c(this,"Zt");c(this,"Ce");c(this,"L",[]);c(this,"$r",[]);c(this,"li",{});c(this,"te");c(this,"q");c(this,"Rt");c(this,"me");c(this,"hi");c(this,"Ae");c(this,"Pt");c(this,"I");c(this,"ci");c(this,"Lt");c(this,"di");c(this,"Ne",[]);c(this,"ae",new Map);c(this,"Aa",{center:r=>Fc(r)+vg(r,this.q)/2-(r.size-this.q)/2,start:r=>Fc(r),end:r=>Fc(r)+vg(r,0)-(r.size-this.q)});c(this,"k");c(this,"wt");c(this,"Jt");c(this,"pi");c(this,"Oa",{center:(r,e,t)=>(e+t)/2-vg(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Gr=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Zt=e.compress===!0,this.Pt=e.absoluteBacked===!0,this.k=e.idFunction,this.wt=e.sizeFunction,this.Jt=e.childVerticesFunction,this.pi=e.absolutePositionFunction,this.me=e.axisIndex,this.Ae=this.me!==1,this.hi=this.me===0?1:0,this.ci=this.Ae?Ee:Q,this.Lt=this.Ae?ve:Ne,this.di=this.Ae?Ne:ve,this.Ce=e.invert===!0,this.I=e.alignment||Vc,this.te=e.padding,this.q=this.Ae?this.te.x:this.te.y,this.Rt=this.Ae?this.te.y:this.te.x}execute(){let r,e,t;for(let n=0;n<this.Gr.length;n++){r=this.Gr[n];let o=this.wt(r.id),s=this.Qe(r,o,0,null,null),a=0;s.root=!0,a=this.mi(s,0);let l=0,h,d,u=(m,g)=>this.Zt&&m.parents&&m.parents.length>0?this.ae.get(this.k(m.parents[0].node)).position[this.ci]+this.Sa(m,this.hi)+this.Rt:g,p=!1;if(a===0&&this.Pt===!0){let m=this.pi(r);!isNaN(m.x)&&!isNaN(m.y)&&(this.gi(r.id,m,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.me===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.me===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.gi(this.k(this.L[e].entries[t].node),{x:h,y:d},e);this.Ce?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Rt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Rt,l+=this.L[e].otherAxisSize)}}return this.ae}gi(r,e,t){this.ae.set(r,{position:e,layer:t});let n=this.wt(r),o=this.me===0?e.x+n.width:e.y+n.height,s=this.me===0?e.x:e.y;this.An=Math.max(this.An,o),this.Sn=Math.min(this.Sn,s)}ut(r){let e=this.L[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.L[r]=e),e}Qe(r,e,t,n,o){let s=this.ut(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Lt],children:[]},l=e[this.di];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Lt]+(r.type===vr?0:this.q),s.entries.push(a),n&&n.children.push(a),a}Ta(r,e){let t=this.$r[e];t||(t=[],this.$r[e]=t),r.index=t.length,t.push(r)}va(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.ut(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.q)}}Sa(r,e){let t=r.parents.map(n=>n.dimensions[e===0?ve:Ne]);return Math.max.apply(null,t)}Ca(r){if(r.size>0){let e=this.Aa[this.I](r),t=this.$r[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.q}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.q;o!==0&&this.Pa(r),this.Ta(r,r.depth)}}_a(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Oa[this.I](r,e,t),o=n-Fc(r);if(this.va(r,n),!NN(r)){let s=gO(r),a=IN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Pa(r){let e=r;for(;e!=null;)this._a(e),e=gO(e)}mi(r,e){if(this.li[r.node.id])return;this.li[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:$()},n=[],o,s={},a=this.ut(e+1),l=this.Jt(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.wt(this.k(h)),u=a.entries.find(p=>this.k(p.node)===this.k(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,m=Fc(u),g=vg(u,this.q),E=m+g/2,y=E-p;y>0&&this.aE(u,y,r)}else{let p=this.Qe(h,d,e+1,r,t);t.nodes.push(p);let m=d[this.Lt];t.size+=m+this.q,n.push(p)}s[h.id]=!0}}for(this.Ca(t),o=0;o<n.length;o++)this.mi(n[o],e+1);return l.length}aE(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var Yc=class extends Ss{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"Qt");c(this,"qt");c(this,"te");c(this,"Tn");c(this,"vn");c(this,"I");c(this,"Ie");c(this,"Si");n=n||{},this.te=n.padding||{x:50,y:50},this.Tn=n.unattachedRootPadding||150,this.Qt=n.lastPlacements,this.vn=n.strategy||"parent",this.Ie=n.edgeNodeSize,this.Si=n.gatherUnattachedRoots,this.I=n.alignment||"center"}lE(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ie:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.Qt?this.Qt.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(g=>this.lE(g.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(g=>g.mainAxis))},m=this.model.getNodeSizeInMainAxis(e);return n=this.vn==="center"?(p.biggestLayer-m)/2:this.vn==="start"?0:p.biggestLayer-m,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.vn==="parent"?this.hE(p,l):this.cE(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}cE(e,t,n,o,s,a,l,h,d){let u=s,p;for(let m=0;m<e.length;m++){this.qt=e[m],t=this.vn==="center"?(o.biggestLayer-l[m].mainAxis)/2:this.vn==="start"?0:o.biggestLayer-l[m].mainAxis,u=s;for(let g=0;g<this.qt.entries.length;g++){p=this.qt.entries[g];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ie:y,A=n===0?y:this.Ie;p.loc={x,y:f,w:b,h:A},u+=this.Ie+h}else this.vertexSet.setPosition(p.obj,x,f,m),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),m<e.length-1&&(this.model.invert?a-=l[m+1].otherAxis+2*d:a+=l[m].otherAxis+2*d)}}hE(e,t){let n=new Uc(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.te,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.I,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let m=[];if(u<this.vertexSet.layers.length-1){let g=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);m.push(...g)}return m},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.An,a=n.Sn,l=0,h=0;if(this.Si&&o.size===1&&this.Qt!=null){let d=this.Qt.rootPosition+this.Qt.rootSize+this.Tn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.Qt){let d=this.Qt.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var zc=class{constructor(r,e){this.D=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"Qc",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.ed(r),o=dt(e),s;return o?(s={id:$(),obj:e,previous:null,size:this.D.qc(),next:null,leaf:!1,type:vr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.D.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.D.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.D.assignedVertices.set(e.id,r),this.Qc.push(s),s}findLayerIndex(r){var e;return(e=this.Qc.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.ed(r),o=this.D.qc();this.D.assignedVertices.set(e.id,r);let s={id:$(),obj:e,size:o,leaf:!1,type:vr,layer:r,vertexSet:this};e.entries.push(s),this.D.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.D.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.D.layout.absoluteBacked)this.Cn(r,e,t,n);else{let o=this.D.layout.model.getVertex(r),s=this.D.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.Cn(r,s.x,s.y,n):this.Cn(r,e,t,n)}}setPosition(r,e,t,n){if(!this.D.layout.absoluteBacked)this.Cn(r.id,e,t,n);else{let o=this.D.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.Cn(r.id,o.x,o.y,n):this.Cn(r.id,e,t,n)}}ed(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}Cn(r,e,t,n){this.D.Kc(r,e,t,n);let o=this.layers[n],s=this.D.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var ab="Hierarchy",Eo=class extends Zn{constructor(e){super(e);c(this,"type",ab);c(this,"axis");c(this,"model");c(this,"Tn");c(this,"yi");c(this,"fi");c(this,"Ce");c(this,"Si");c(this,"td");c(this,"bn");c(this,"rd");c(this,"I");c(this,"nd");c(this,"Ei");c(this,"Ie");c(this,"bi");c(this,"La");c(this,"routingInformation");c(this,"resultSets",[]);this.Tn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.yi=e.options.maxIterationsWithoutImprovement||5,this.fi=e.options.maxIterations||24,this.rd=e.options.rootNode,this.bn=e.options.getRootNode,this.nd=e.options.placementStrategy,this.Ie=e.options.edgeNodeSize||Ag,this.Ce=e.options.invert===!0,this.Si=e.options.gatherUnattachedRoots===!0,this.I=e.options.alignment||Vc,this.td=e.options.generateRouting===!0,this.bi=e.options.edgeFilter,this.La=e.options.filteredEdgeProcessor,this.Ei=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.bn?this.bn():this.rd;this.model=new Bc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.Tn,edgeNodeSize:this.Ie,edgeFilter:this.bi},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:Ag}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new zc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Gc(this.model,d);u.execute(l),new Ts(d,(g,E,y)=>this.model.getAdjacentEntries(g,E,y),{maxIterations:this.fi,maxIterationsWithoutImprovement:this.yi}).execute(),h=new Yc(this.model,d,{padding:this.padding,strategy:this.nd,edgeNodeSize:this.Ie,lastPlacements:h,gatherUnattachedRoots:this.Si,unattachedRootPadding:this.Tn,alignment:this.I}).execute(l);let p=[];if(d.layers.flatMap(g=>g.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?g.ymax-g.ymin:g.xmax-g.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.La){let g=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.La(g,this)}let m={};this.td&&(this.routingInformation=this.model.sets.map(g=>{let E={gates:g.gates,edges:g.edgeRouting,edgeMap:g.edgeRoutingMap,regions:g.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new $c(this.model,d,this.axis,this.Ce,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:m}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(Eo,"type",ab),nt.register(Eo.type,Eo);var Xc=class{constructor(r){this.color=r}generate(r){return this.color}},Li=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=MN(r);return i.fromString(e)}}};function MN(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function EO(){return new Li(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var vs=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=EO(),s=this.assignedColors.find(a=>hb(a,o)<20);for(;s!=null&&n<10;)o=EO(),s=this.assignedColors.find(a=>hb(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},lb=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function hb(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function jc(i){let r=X(i)?Li.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Li(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new Li(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function VN(i){let r=X(i)?Li.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Li(0,0,0):new Li(255,255,255)}var Cg="empty",fO=[{dx:0,dy:-1,axis:ue,directionFromParent:-1},{dx:1,dy:0,axis:re,directionFromParent:1},{dx:0,dy:1,axis:ue,directionFromParent:1},{dx:-1,dy:0,axis:re,directionFromParent:-1},{dx:-1,dy:-1,axis:yn,directionFromParent:-1},{dx:1,dy:-1,axis:Jn,directionFromParent:-1},{dx:1,dy:1,axis:yn,directionFromParent:1},{dx:-1,dy:1,axis:Jn,directionFromParent:1}],yO=[{dx:0,dy:-1,axis:ue,directionFromParent:-1},{dx:1,dy:0,axis:re,directionFromParent:1},{dx:0,dy:1,axis:ue,directionFromParent:1},{dx:-1,dy:0,axis:re,directionFromParent:-1}],cb=(i,r,e,t)=>yO.filter(n=>n.axis!==e||n.directionFromParent===t),Pg=(i,r,e,t)=>{let n=[];switch(e){case Jn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case yn:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case re:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case ue:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return fO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Ps=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"pt",{});c(this,"Ti");c(this,"od");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.Ti={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.od=t*(n+o)}ko(r,e){return{x:Math.floor((r-this.Ti.x)/this.gridCellSize),y:Math.floor((e-this.Ti.y)/this.gridCellSize)}}dE(r){let e=this.ko(r.x,r.y),t=this.ko(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}uE(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.Ti.x+t,s=this.Ti.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}pE(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}mE(r,e,t,n){let o=this.makeKey(r,e);if(this.pt[o]==null){let s=this.uE(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.od),d=[],u=[],p=!1,m=!1;h.forEach(g=>{if(!p&&(this.sourceId===g.id||this.sourceObstacles.indexOf(g.id)!==-1)&&(p=!0),!m&&(this.targetId===g.id||this.targetObstacles.indexOf(g.id)!==-1)&&(m=!0),!this.pE(g.id)){let E=Tx(this.dE(g),this.vertexBorder,this.vertexBorder);u.push(g.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(g.id)}}),this.pt[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:m}}else t&&(this.pt[o].ax=t),n&&(this.pt[o].ay=n);return this.pt[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.mE(r,e,t,n)}reinitialize(){Object.entries(this.pt).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function Cs(i,r){return i===0&&r===0?void 0:i===0&&r!==0?ue:i!==0&&r===0?re:Math.sign(r)===Math.sign(i)?yn:Jn}function db(i,r,e){return e==null?0:e===re?i>0?1:-1:e===ue?r>0?1:-1:e===yn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function _g(i){let r=Cs(i.ox,i.oy);return{axis:r,direction:db(i.ox,i.oy,r)}}function ub(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?re:ue}function Nr(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return Cs(r,e)}}function pb(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=Cs(r,e);return db(r,e,t)}}function GN(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Nr(i);return Nr(r)===t?-1:Nr(e)===t?1:0}}var Hc=class{constructor(){c(this,"node")}sort(r,e){return GN(this.node,r,e)}};var kt="group:added",wi="group:member:added",_s="group:member:removed",Me="group:removed",fo="dataLoadStart",Og="dataAppendStart",Ir="dataLoadEnd",Rg="dataAppendEnd",Lg="dataUpdated",bn="graphClearStart",Wt="graphCleared",mb="graphChanged",Oe="group:updated",Ve="node:updated",lr="port:updated",yt="edge:updated",hr="edge:added",Zt="node:added",xt="edge:removed",Re="node:removed",Kn="port:added",Mr="port:removed",en="edge:target",tn="edge:source",Jt="select",Kt="deselect",rr="selection:cleared",qn="edge:geometry",Qn="edge:pathEdited",gb="edge:dragStart",Eb="edge:drag",fb="edge:dragEnd",yb="edge:dragAbort",kc="edge:typeChanged",Wc="node:typeChanged",Zc="port:typeChanged",Jc="group:typeChanged",xb="group:move:start",Kc="group:move",Vr="group:move:end",qc="internal:group:sizeChanged",Qc="internal:group:sizeChangedRedo",ed="internal:group:sizeChangedUndo",bb="internal:edge:redraw",Ab="renderer:added",Os="node:move:start",nr="node:move",Mt="node:move:end",td="node:move:abort",Rs="undoredo:update",Sb="undo",Tb="redo",Di="destroy";var $N=[Zt,Kn,hr,kt,Re,Mr,xt,Me,Ve,lr,yt,Oe,Mt,Vr,tn,en,wi,_s],Ls=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},dl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"Wo",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||Ht,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.Wo==null?this.Wo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.Wo),this.Wo=setTimeout(o,e.debounceTimeout))};Ls(this,fo,()=>{n=!0}),Ls(this,Ir,()=>{n=!1}),Ls(this,bn,()=>{n=!0}),Ls(this,Wt,()=>{n=!1}),Ls(this,Lg,s),Ls(this,Qn,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},rd=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(Lg)};$N.forEach(t=>Ls(this,t,e))}};var vb="mixed",nd="isolated",Cb="nodesOnly",Pb="groupsOnly",_b="edgesOnly",ws=class ws extends Gt{constructor(e,t){super();this.instance=e;c(this,"er",1/0);c(this,"sd",1/0);c(this,"ad",1/0);c(this,"de",[]);c(this,"Q",[]);c(this,"ee",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Me",{});c(this,"Fr");c(this,"Zo",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.Fr=t.mode||vb,this.instance.bind(Re,n=>{this.Nt(n.node)}),this.instance.bind(Me,n=>{this.Nt(n.group)}),this.instance.bind(Mr,n=>{this.Nt(n.port)}),this.instance.bind(xt,n=>{this.Nt(n.edge)}),this.instance.bind(en,n=>{this.Me[n.edge.getFullId()]&&this.fire(en,n)}),this.instance.bind(tn,n=>{this.Me[n.edge.getFullId()]&&this.fire(tn,n)}),this.instance.bind(Zt,n=>{this.generator&&this.autoFill&&!this.Zo&&this.reload()}),this.instance.bind(kt,n=>{this.generator&&this.autoFill&&!this.Zo&&this.reload()}),this.instance.bind(Ve,n=>{this.Me[n.vertex.getFullId()]&&this.fire(Ve,n)}),this.instance.bind(Oe,n=>{this.Me[n.vertex.getFullId()]&&this.fire(Oe,n)}),this.instance.bind(yt,n=>{this.Me[n.edge.getFullId()]&&this.fire(yt,n)}),this.instance.bind(lr,n=>{n.port!=null&&this.Me[n.port.getFullId()]&&this.fire(lr,n)}),this.instance.bind(Wt,()=>{this.clear()}),this.instance.bind(Ir,()=>{this.reload()}),this.setCapacityPolicy(ws.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.de.length===0&&this.Q.length===0&&this.ee.length===0}ld(e){return e.objectType===Ue.objectType?this.ee:e.objectType===le.objectType?this.de:this.Q}setMode(e){this.Fr=e,e===nd?this.gE():e===_b?this.hd():e===Cb?(this.wa(),this.cd()):e===Pb&&(this.wa(),this.dd())}EE(e){let t=[],n=this.ld(e),o=e.objectType===Ue.objectType?this.sd:e.objectType===le.objectType?this.er:this.ad;if(n.length>=o){if(this.capacityPolicy===ws.DISCARD_NEW)return!1;t=n.splice(0,1),this.Da(t[0],":removed"),delete this.Me[t[0].getFullId()]}return n.push(e),this.Da(e,":added"),t}Da(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}ud(e,t){if(this.fE(e)&&!this.Me[e.getFullId()]){let n=this.EE(e);return n===!1?[[],[]]:(this.Me[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}fE(e){return this.Fr===vb||this.Fr===Cb&&e.objectType===le.objectType||this.Fr===Pb&&e.objectType===ie.objectType||this.Fr===_b&&e.objectType===Ue.objectType?!0:this.Fr===nd?e.objectType===Ue.objectType?this.de.length===0&&this.Q.length===0:this.ee.length===0:!1}Nt(e,t){let n=e.getFullId();return Dt(this.ld(e),s=>s.getFullId()==n)?(delete this.Me[e.getFullId()],t&&t(e,!1),this.Da(e,":removed"),[[],[e]]):[[],[]]}yE(e,t){return this.Me[e.getFullId()]?this.Nt(e,t):this.ud(e,t)}Na(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(X(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.Ye)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.Na(e,this.Nt.bind(this),t)}append(e,t){return this.Na(e,this.ud.bind(this),t)}toggle(e,t){return this.Na(e,this.yE.bind(this),t)}setMaxNodes(e){this.er=e}setMaxGroups(e){this.ad=e}setMaxEdges(e){this.sd=e}setCapacityPolicy(e){this.capacityPolicy=e}wa(){for(let e=this.ee.length,t=0;t<e;t++)this.Nt(this.ee[0])}dd(){for(let e=this.de.length,t=0;t<e;t++)this.Nt(this.de[0])}cd(){for(let e=this.Q.length,t=0;t<e;t++)this.Nt(this.Q[0])}hd(){this.dd(),this.cd()}gE(){this.hd(),this.wa()}clear(e){this.de.length=0,this.ee.length=0,this.Q.length=0,this.Me={},this.fire(bn),e||this.onClear(this)}xE(e){let t=[];for(let n=0;n<e.length;n++)this.Me[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Zo=!0,this.fire(fo,{}),this.generator(this,this.instance),this.fire(Ir,{}),this.onReload&&this.onReload(),this.Zo=!1)}Ye(e,t){let n=t===Ue.objectType?this.ee:t===ie.objectType?this.Q:this.de;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.Ye(e,le.objectType)}eachGroup(e){this.Ye(e,ie.objectType)}eachVertex(e){this.Ye(e,le.objectType),this.Ye(e,ie.objectType)}eachEdge(e){this.Ye(e,Ue.objectType)}getNodeCount(){return this.de.length}getNodeAt(e){return this.de[e]}getNodes(){return this.de}getNode(e){return this.de.find(t=>t.id===e)}getGroupAt(e){return this.Q[e]}getGroups(){return this.Q}getGroup(e){return this.Q.find(t=>t.id===e)}getGroupCount(){return this.Q.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.de),Array.prototype.push.apply(e,this.ee),Array.prototype.push.apply(e,this.Q),e}getAllEdgesFor(e,t){return this.xE(e.getAllEdges(t))}getEdgeCount(){return this.ee.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.ee[e]}getEdges(){return this.ee}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}bE(e){return new ws(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.bE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c(ws,"DISCARD_EXISTING","discardExisting"),c(ws,"DISCARD_NEW","discardNew");var cr=ws;var Ni=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"Ia");c(this,"Ma");c(this,"vi");c(this,"pd");c(this,"md");c(this,"gd");c(this,"Ed");this.source=r.source.getFullId(),this.target=r.target.getFullId(),H(r.source)&&(this.Ia=r.source.id,this.source=r.source.getParent().getFullId()),H(r.target)&&(this.Ma=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.vi=r.geometry,r.source.dummy&&(this.pd=!0,this.gd={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.md=!0,this.Ed={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.pd?this.gd:this.Ia==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.Ia}generateTargetIdentifier(){return this.md?this.Ed:this.Ma==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ma}Qe(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.vi},e=this.instance.$_addEdge(r,Fx,null);this.manager.edgeChange(this.edgeId,e)}tt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Dg=class extends Ni{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},Ng=class extends Ni{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.Qe()}redo(){this.tt()}hasDeltas(){return this.obj!=null}},wg=class extends Ni{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return Ci(this.newVertex)&&Ci(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!Ci(this.newVertex)&&!Ci(this.oldVertex)&&Dx(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Ig=class extends wg{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Mg=class extends wg{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var yo=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=$()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof Ni&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];Ob(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):Rb(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):Lb(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Ds=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var id=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===le.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===ie.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}fd(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},pl=class extends id{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.fd()}redo(){this.$add()}},ul=class extends id{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.fd()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},od=class extends ul{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},ml=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.Ur(Qc,this.newGroupSize,this.originalGroupSize)}undo(){this.Ur(ed,this.originalGroupSize,this.newGroupSize)}Ur(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function Ns(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function BN(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function sd(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Ii=class{constructor(r,e,t,n){this.obj=r;this.instance=t;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Ns({},r.data),this.$od=Ns({},e),this.reason=n}yd(r){this.obj.objectType===le.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===ie.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===ce.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Ue.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.yd(this.$od)}redo(){this.yd(this.$nd)}hasDeltas(){return!rl(this.$nd,this.$od)}};var ad=class{constructor(r,e,t){this.obj=r;this.Pn=e;this.instance=t}Qe(){this.instance.addPort(this.Pn,this.obj.data)}tt(){this.instance.removePort(this.Pn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},ld=class extends ad{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.tt()}redo(){this.Qe()}hasDeltas(){return this.obj!=null}},hd=class extends ad{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.Qe()}redo(){this.tt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Vg=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},cd=class extends Vg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.Ga=o;this.Va=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Va!=null&&this.renderer.setPosition(this.node.id,this.Va.x,this.Va.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Ga!=null&&this.renderer.setPosition(this.node.id,this.Ga.x,this.Ga.y)}},dd=class extends Vg{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ba=o;this.$a=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.$a!=null&&this.renderer.setPosition(this.node.id,this.$a.x,this.$a.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ba!=null&&this.renderer.setPosition(this.node.id,this.Ba.x,this.Ba.y)}},ud=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},pd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var gl=class{constructor(r,e,t){this.Fa=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.Fa.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var wb="internal.connection",md="internal.element:repainted",El="context:update",gd="group:collapse",Ed="group:expand",ei="zoom",fd="render:start",An="render:end",Db="adhocLayout",Is="afterLayoutRefresh",fl="group:relayout",Gr="group:render",Ms="internal.vertex:updated",$r="node:render",yd="node:visibility",xd="plugin:added",Nb="plugin:removed",Sn="relayout",Ib="objectRepainted",Ye="click",bt="contextmenu",xo="dblclick",Br="dbltap",Mb="focus",pe="mousedown",Gg="mouseenter",$g="mouseexit",oe="mousemove",Vb="mouseleave",se="mouseup",ot="mouseout",st="mouseover",W="tap",Gb="touchstart",$b="touchend",Bb="touchmove",Fb="vertex:click",Ub="vertex:dblclick",Yb="vertex:dbltap",zb="vertex:mouseout",Xb="vertex:mouseover",jb="vertex:mousemove",FN="vertex:mouseup",UN="vertex:mousedown",Hb="vertex:contextmenu",kb="vertex:tap",Wb="edge:click",Zb="edge:dblclick",Jb="edge:dbltap",bd="edge:mouseout",Ad="edge:mouseover",Kb="edge:mouseup",yl="edge:mousedown",qb="edge:contextmenu",Qb="edge:tap",bo="canvasClick",eA="canvasDblClick",Sd="edge:redraw",Td="start",vd="lasso:update",Cd="lasso:end",xl="pan",Tn="modeChanged",YN="allGroupsRelayout",tA="groupRelayoutAdhoc",zN="groupMemberRemoved",rA="newVertexAddedToGroup",nA="existingVertexAddedToGroup";var bl=class extends Ii{constructor(e,t,n,o){super(e,t,n,o);this.obj=e;this.instance=n;c(this,"type","vertexUpdate");o===Vs&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Gs=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var iA=class{constructor(r,e,t,n,o){this.T=r;this.AE=e;this.bd=t;this.vi=n;this.Fa=o;c(this,"type","edgePath")}xd(r){this.T.setEdgeGeometry(this.AE,r,null,this.Fa)}undo(){this.xd(this.bd)}redo(){this.xd(this.vi)}hasDeltas(){return!rl(this.bd,this.vi)}},XN=50,oA="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",jN="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",Pd=class{constructor(r){c(this,"T");c(this,"Jo");c(this,"It");c(this,"Ua");c(this,"undoStack");c(this,"redoStack");c(this,"za",[]);c(this,"ue");c(this,"rr",0);this.T=r.instance,this.It=!1,this.undoStack=[],this.redoStack=[],this.Jo=r.maximumSize||XN,this.Ua=r.onChange,this.SE()}Ad(r){this.It=r}dataLoadStart(){this.clear(),this.Ad(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.Ad(!1)}dataAppendEnd(){this.dataLoadEnd()}SE(){this.T.bind(Wt,()=>{this.clear()}),this.T.bind(Zt,r=>{this.command(new pl(r.node,this.T))}),this.T.bind(Re,r=>{this.command(new ul(r.node,this.T))}),this.T.bind(Ve,r=>{tl(r.updates)||this.command(new bl(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(kt,r=>{this.command(new pl(r.group,this.T))}),this.T.bind(Me,r=>{this.command(new od(r,this.T))}),this.T.bind(Oe,r=>{tl(r.updates)||this.command(new bl(r.vertex,r.originalData,this.T,r.reason))}),this.T.bind(qc,r=>{let e=new ml(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(hr,r=>{this.command(new Dg(r.edge,this.T,this))}),this.T.bind(xt,r=>{this.command(new Ng(r.edge,this.T,this))}),this.T.bind(yt,r=>{tl(r.updates)||this.command(new Ii(r.edge,r.originalData,this.T,r.reason))}),this.T.bind(tn,r=>{this.command(new Ig(this.T,this,r.edge,r.old,r.new))}),this.T.bind(en,r=>{this.command(new Mg(this.T,this,r.edge,r.old,r.new))}),this.T.bind(Qn,r=>{this.command(new iA(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(Kn,r=>{this.command(new ld(r.port,r.vertex,this.T))}),this.T.bind(Mr,r=>{this.command(new hd(r.port,r.vertex,this.T))}),this.T.bind(lr,r=>{tl(r.updates)||this.command(new Ii(r.port,r.originalData,this.T,null))}),this.T.bind(wi,r=>{r.vertexIsNew!==!0&&this.command(new cd(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(_s,r=>{this.command(new dd(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(Wc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Zc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Jc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(kc,r=>{this.command(new Gs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Mt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ds(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Vr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Ds(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(gd,e=>{this.command(new ud(e.group,r.renderer))}),r.renderer.bind(Ed,e=>{this.command(new pd(e.group,r.renderer))}),r.renderer.bind(Re,e=>{this.command(new gl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Me,e=>{this.command(new gl(r.renderer,e.vertex,e.pos))})})}Ci(){this.Ua&&this.Ua(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.It){if(!r.hasDeltas())return;AO(r)&&(r=r.compress()),this.ue!=null?this.ue.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.Jo&&this.undoStack.splice(this.undoStack.length-this.Jo-1,this.undoStack.length-this.Jo),this.redoStack.length=0,this.Ci())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof Ni&&o.edgeId===r?o.edgeChange(e):o instanceof yo&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.It=!0,this.redoStack.push(r),r.undo(),this.It=!1,this.Ci())}redo(){let r=this.redoStack.pop();r&&(this.It=!0,this.undoStack.push(r),r.redo(),this.It=!1,this.Ci())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.ue=null,this.rr=0,this.It=!1,this.Ci()}transaction(r,e,t){if(this.ue!=null&&e==null)return U(oA),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.ue;return this.ue=null,this.command(a),a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.ue!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.TE(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}TE(r,e){e instanceof yo?e.$mergeInto(r):r.addAction(e,!0)}vE(){return this.ue=new yo,this.rr=0,this.ue.id}openTransaction(r){if(!this.It){let e=!0;if(this.ue!=null)if(r!=null)if(r===xO)this.commitTransaction();else if(r===bO)this.rollbackTransaction();else if(r===ut)e=!1,this.rr++;else throw new Error(oA);else throw new Error(oA);return e&&this.vE(),this.ue.id}return null}rollbackTransaction(){this.ue!=null&&(this.rr>0?(this.rr--,U(jN)):(this.ue.undo(),this.ue=null,this.Ci(),this.za.length=0))}commitTransaction(r){if(this.ue!=null)if(r!==!0&&this.rr>0)this.rr--;else{let e=this.ue;this.ue=null,this.command(e),this.rr=0,this.CE()}}CE(){this.ue==null&&(this.za.forEach(r=>{try{r()}catch(e){}}),this.za.length=0)}},xO="commitCurrent",bO="rollbackCurrent",ut="appendToCurrent";function AO(i){return i instanceof yo}function Ob(i){return i instanceof Ii||i instanceof bl}function Rb(i){return i instanceof Ds}function Lb(i){return i instanceof ml}var Bg="1.1.4";var sA="type",aA="default",dA="groupResized",SO="addPort",TO="addNewPort",vO="removePort",_d="updatePort",$s="moved",HN="layout",Fg="updateVertex",lA="updateNode",hA="updateGroup",uA="magnetizer",Rd="setPosition",pA="snapToGrid",kN="sizeGroupToFit",Al="drawingToolsResize",Vs="rotation",mA="resized",cA="updated",Od=class extends Gt{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"Ya");c(this,"Sd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"Td");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"ge");c(this,"zr",new Map);c(this,"Pi",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new Pd({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Rs,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||ng,this.typeProperty=e.typeProperty||sA,this.edgeTypeProperty=e.edgeTypeProperty||sA,this.portTypeProperty=e.portTypeProperty||sA,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||aA),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||aA),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||aA),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new Pc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!ar(a)?{}:a,a=lt(a),a.id=a.id||$(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||Jx,this.modelTopAttribute=e.modelTopAttribute||Kx,this.modelWidthAttribute=e.modelWidthAttribute||Qx,this.modelHeightAttribute=e.modelHeightAttribute||eb,this.modelRotationAttribute=e.modelRotationAttribute||qx,this.Pi=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.Sd=e.autoSave&&e.autoSave.enabled!==!1,this.Td={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],m=u==null?1/0:u,g=p==null?1/0:p;return m-g}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new il(this.Td),this.Sd&&(this.autoSaver=new dl(this,e.autoSave)),new rd(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=H(o)?o.getParent():o,d=H(s)?s.getParent():s,u=H(o)?this.model.getPortDefinition(a):K(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=H(s)?this.model.getPortDefinition(l):K(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),m=K(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),g=K(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(m.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||g.allowLoopback===!1):h===d?!(m.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||g.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.ge=this.Ko(o=>{this.N(s=>s.$selectionCleared(o)),this.fire(rr,{selection:o})}),e.selectionMode&&this.ge.setMode(e.selectionMode),e.maxSelectedNodes&&this.ge.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.ge.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.ge.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.ge.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}PE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}qo(e,t,n,o){if(X(e))return[this.graph.getVertex(e,!0),!1];if(K(e)||Y(e)||H(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.vd(this.PE(t,{x:a,y:l},n),o),!0]}}Ko(e){return new cr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.Ko();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new dl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.Xa(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.Xa(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},ol,null))),t}clear(){return this.N(e=>e.$graphClearStart()),this.fire(bn),this.graph.clear(),this.$transientVerticesByRenderer={},this.N(e=>e.$graphClearEnd()),this.fire(Wt),this}destroy(){this.clear(),delete this.zr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.Pi[e]=t}getDescendants(e){return xs(e)}getAncestors(e){return En(e)}isAncestor(e,t){return Xe(e,t)}isDescendantGroup(e,t){return $x(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=X(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(K(e)?this.typeFunction:H(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===le.objectType?this.typeProperty:e.objectType===ce.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t)}$dispatchTypeChange(e,t,n){let o,s;K(e)?(o=Wc,s=()=>this.N(a=>a.$nodeTypeChanged(e,t,n))):H(e)?(o=Zc,s=()=>this.N(a=>a.$portTypeChanged(e,t,n))):rt(e)?(o=kc,s=()=>this.N(a=>a.$edgeTypeChanged(e,t,n))):Y(e)&&(o=Jc,s=()=>this.N(a=>a.$groupTypeChanged(e,t,n))),o!=null&&(this.fire(o,{obj:e,previousType:t,newType:n}),s())}resolveFullId(e){if(rt(e))return e.id;if(K(e))return e.id;if(Y(e))return e.id;if(H(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return H(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=$());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e.group!=null)if(o=this.getGroup(e.group),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e.group+"] not found");return this.Xa(s,o),o!=null&&this.fire(wi,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}Xa(e,t){let n={node:e,parentGroup:t};this.N(o=>o.$nodeAdded(n)),this.fire(Zt,n)}OE(e,t){let n={group:e,parentGroup:t};this.N(o=>o.$groupAdded(n)),this.fire(kt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}Cd(e){return ys(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.Cd(t);o[n.id]=n,n.transientRenderer=t.id}return n}vd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.N(o=>{o.$renderDummyVertex(n)}),n}Qo(e){this.graph.deleteNode(e),this.N(t=>{t.$nodeRemoved({node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.vd({id:`${e.id}_${n===it?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===it?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.Cd(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:Ux},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.Pi[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=$()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e.group!=null){if(n=this.getGroup(e.group),n==null)throw new Error("Cannot find parent group ["+e.group+"]");this.graph.$addMemberToGroup(o,n)}this.OE(o,n),n!=null&&this.fire(wi,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.Pi[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:$(),group:h.id}),m=this.addNode(p);s.set(u,m.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,m=Object.assign({},d,{id:$(),group:h.id});p&&typeof p!="string"&&delete m.groupTemplate;let g=this.addGroup(m);if(s.set(u,g.id),p)if(typeof p=="string"){let E=this.Pi[p];if(E)try{a(E,g)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,g)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),m=s.get(u[0])||u[0],g=s.get(p[0])||p[0],E=u[1]==null?m:[m,u[1]].join(this.portSeparator),y=p[1]==null?g:[g,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data.group=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.N(p=>{p.$groupMemberAdded(u)}),this.fire(wi,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.N(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data.group,this.fire(_s,h)}return l}Pd(e,t,n,o){e.nestedGroups.forEach(a=>this.Pd(a,t,!0,o)),e.nodes.forEach(a=>this.Od(a,!0,o));for(let a=0;a<e.edges.length;a++)this.ja(e.edges[a]);let s={group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.N(a=>a.$groupRemoved(s)),o||this.fire(Me,s)}Od(e,t,n){for(let s=0;s<e.edges.length;s++)this.ja(e.edges[s]);let o={node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.N(s=>s.$nodeRemoved(o)),n||this.fire(Re,o)}removeGroup(e,t,n){let o=this.graph.getVertex(X(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data.group),this.Pd(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!X(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(X(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.Od(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,ol,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.qo(e.source,s,0,n),[h,d]=this.qo(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),m={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.N(g=>g.$edgeAdded(m,e.context)),o||this.fire(hr,m,null),p}else return this.debugEnabled&&U("Could not add edge"),null}ja(e,t){let n={edge:e,source:t};this.N((o,s)=>o.$edgeRemoved(n)),this.fire(xt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&K(n.source)&&this.Qo(n.source),n.target.dummy&&K(n.target)&&this.Qo(n.target),this.ja(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.qo(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.Qo(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeTargetChanged(l)}),this.fire(en,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.qo(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.Qo(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeSourceChanged(l)}),this.fire(tn,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.es(o,TO);let h={vertex:o,data:s,port:l};this.N(d=>d.$portAdded(h)),this.fire(Kn,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.es(n,SO);let s={vertex:n,data:t,port:o};return this.N(a=>a.$portAdded(s)),this.fire(Kn,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else H(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.es(n,vO);let a={vertex:n,port:o,edges:s};return this.N(l=>l.$portRemoved(a)),this.fire(Mr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&K(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&rt(n.obj))this.removeEdge(n.obj);else{for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.zr)this.zr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,hA,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,lA,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,Fg,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(H(a.obj)?a.obj.getParent():a.obj).objectType===le.objectType?Ve:Oe;this._d(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||Fg,source:s}))}}updateVertices(e,t){this._E(e,Fg,!1,t)}_E(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,_d,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this._d(s.obj,t,o,lr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||_d}))}updateEdge(e,t){this.$_updateEdge(e,t,cA,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let l in t)s.data[l]==null?s.data[l]=t[l]:Zm(s.data,l,t[l]);this.Rd(a,s),this.fire(yt,{edge:s,updates:t||{},originalData:a,reason:n},null)}}update(e,t){this.yn(e,t,null,!1)}yn(e,t,n,o){if(K(e)){let s=n==null?lA:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?hA:n;this.$_updateVertex(e,t,s,o)}else if(rt(e)){let s=n==null?cA:n;this.$_updateEdge(e,t,s,o)}else if(H(e)){let s=n==null?_d:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(Qn,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.N(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new al(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===le||e.constructor===ce||e.constructor===ie||e.constructor===Ue?e:X(e)||ar(e)?this.graph.getVertex(e):null}ts(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.N(l=>{l.$select(a)}),this.fire(Jt,a))})}RE(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let m;rt(h)?m=[h]:m=t(h),e.filter&&(m=m.filter(e.filter));for(let g=0;g<m.length;g++){let E=d&&h===this.graph||m[g].source===h||n&&H(m[g].source)&&m[g].source.getParent()===h,y=u&&h===this.graph||m[g].target===h||n&&H(m[g].target)&&m[g].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(m[g])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}Rd(e,t){let n=t.objectType===Ue.objectType?this.edgeTypeProperty:t.objectType===ce.objectType?this.portTypeProperty:this.typeProperty;if(t.data[n]!=null&&t.data[n]!==e[n]){let o=t.data[n],s=e[n];t.type=o,this.$dispatchTypeChange(t,s,o)}}_d(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===ce.objectType?e.getFullId():e.id,h=e.objectType===ce.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let p in t)Zm(e.data,p,t[p]);e.objectType===ce.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.es(e.getParent(),_d))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.N(p=>p.$vertexUpdated(u)),this.Rd(a,e),this.fire(o,u,null)}}es(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Ya)){let o=Y(e)?Oe:Ve,s={vertex:e,updates:{},originalData:e.data,reason:t};this.N(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.RE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(rt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.Oi(e);this.ts(t,!1,this.ge,!0)}select(e,t){let n=this.Ko(),o=this.Oi(e),s=this.ts(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(K(l||Y(l)||H(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Ld(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.Ld(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.Ko();if(o.obj&&o.obj.objectType===le.objectType){t&&this.ts(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Ld(o.obj,s,n,a)}return s}Oi(e){return e instanceof al||e instanceof cr?e:X(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>X(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.Oi(e);if(t){let n=this.ts(t,!0,this.ge,!1);n[1]!=null&&n[1].length>0&&this._i(!1,n[1]),n[0]!=null&&n[0].length>0&&this._i(!0,n[0])}}_i(e,t){let n=e?Jt:Kt;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.ge};this.N(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.Oi(e);if(t){let n=[],o=this.ge.toggle(t,(s,a)=>{a||n.push(s)});this._i(!1,o[1]),this._i(!1,n),this._i(!0,o[0])}}removeFromSelection(e){let t=this.Oi(e);t&&this.ge.remove(t,n=>{let o={obj:n,selection:this.ge};this.N(s=>{s.$deselect(o)}),this.fire(Kt,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.ge.clear()}getSelection(){return this.ge}setMaxSelectedNodes(e){this.ge.setMaxNodes(e)}setMaxSelectedEdges(e){this.ge.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.ge.setCapacityPolicy(e)}LE(e){this.fire(e),this.Ya=!1}wd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(m){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=m=>{e.incremental===!1&&this.clear(),this.Ya=!0,t===fo?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.N(g=>g.$dataLoadStart())):t===Og&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.N(g=>g.$dataAppendStart())),this.fire(t),Xx(o,m,this,d),this.LE(n),h&&h(this,m),this.fire(mb),n===Ir?(this.N(g=>g.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===Rg&&(this.N(g=>g.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let m=o===Ht||o===og?Ht:e.dataType,g=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:m,error:u,headers:g})}return this}load(e){return this.wd(e,fo,Ir)}append(e){return this.wd(e,Og,Rg)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},sg(e.type||Ht,this,e.parameters)}toJSON(){return sg(Ht,this,{})}getRenderer(e){return this.zr.get(e)}N(e,t){this.zr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||$(),this.zr.set(t,e),e.id=t,e.onDestroy(n=>{this.zr.delete(n.id)}),this.fire(Ab,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(Sb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(Tb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return Bg}$_deriveEdgeId(e){return e==null?$():typeof e=="string"?e:this.edgeIdFunction(e)||$()}};var WN="csv";function CO(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var Ug=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=CO(this.lines[0])):this.headers=e.headers}Dd(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=CO(t);r(n)}}readLines(r){this.Dd(e=>r(e))}readRecords(r){this.Dd(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},gA=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new Ug(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function EA(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function PO(i,r){return r?i:i.toLowerCase()}function ZN(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=Tt(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var JN=ZN;function KN(i){return i=Tt(i),[{token:i.replace(/\s/g,"_"),context:i}]}function _O(i){return[{token:Tt(i),context:i}]}function qN(i,r){return i.score>r.score?-1:1}var QN=i=>i.id;function eI(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var tI=10,Sl=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"Nd",0);c(this,"Ri",new Map);c(this,"Yr",[]);c(this,"rs",0);c(this,"we",{});r=r||{},this.fields=r.fields,this.root=this.Ha(),this.tokenizer=r.tokenizer||JN,this.searchTokenizer=r.searchTokenizer||_O,this.limit=r.limit||tI,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||QN,this.sorter=r.sorter||qN}Ha(r){return{index:this.Nd++,children:{},documentIds:{},key:r}}wE(r,e,t){let n=this.we[r];n||(n={},this.we[r]=n),n[e.index]=e}DE(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.Ha(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.wE(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);eI(this.Yr,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Ri.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.DE(PO(l[h].token,this.caseSensitive),o,l[h].context)}}),this.rs++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.we[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.Yr.length;n++)if(this.idFunction(this.Yr[n].document)===e){o=n;break}o!==-1&&(this.Yr.splice(o,1),this.rs=this.Yr.length),this.Ri.delete(e)}clear(){this.Ri.clear(),this.we={},this.Nd=0,this.Yr.length=0,this.rs=0,this.root=this.Ha()}getDocumentCount(){return this.rs}getDocumentList(){return this.Yr}getDocument(r){return this.Ri.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let m=n[d];m||(m={},n[d]=m,s[d]=0,a[d]=[]),a[d].push(p),m[u]||(m[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let g in d.documentIds)if(d.documentIds.hasOwnProperty(g)){let E=d.documentIds[g];for(let y=0;y<E.length;y++)l(g,p,E[y])}return}let m=p[u];d.children[m]&&h(d.children[m],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,PO(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Ri.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},fA=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new Sl(e),this.groupIndex=new Sl(e),this.edgeIndex=new Sl(e),this.portIndex=new Sl(e),r.bind(Zt,t=>{this.Id(t.node)}),r.bind(Re,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Ve,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(kt,t=>{this.Md(t.group)}),r.bind(Me,t=>{this.groupIndex.remove(t.group.data)}),r.bind(Oe,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(hr,t=>{this.Vd(t.edge)}),r.bind(xt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(yt,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(Kn,t=>{this.portIndex.add(t.port.data)}),r.bind(Mr,t=>{this.portIndex.remove(t.port.data)}),r.bind(lr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Wt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Id(n)}),this.instance.eachGroup((t,n)=>{this.Md(n)}),this.instance.eachEdge((t,n)=>{this.Vd(n)})}Id(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}Md(r){this.groupIndex.add(r.data)}Vd(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var yA="context",Yg="lookup",xA="default",ti="element",Mi="text",Ao="tmpl",ri="each",Tl="if",bA="root",AA="class",SA="style",So="$value",vl="$key",TA="attribute";function zg(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return Lx(e)}}function CA(i){return i.length>0?i[i.length-1]:null}function PA(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function Xg(i,r,e,t,n){let o=$(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function vA(i,r,e,t,n){e.atts[i]=r,Xg(i,r,e,t,n)}function _A(i,r){let e=zg(i,r.attributesRe),t={el:Tt(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?vA(o,"",t,s,r):vA(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=Tt(e[o]);s!=null&&s.length>0&&n(s)}return t}var rI=["*","-","+","/","%"],OO=["==",">","<",">=","<=","===","!=","!==","||"],nI=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Ld="bool",RO="num",LO="group",wO="var",iI="op",OA="comp",DO="exp",NO="string",IO="array",MO="key",VO="value";function oI(i){return i[i.length-1]}function GO(i){return i.t===LO}function sI(i){return i.t===wO}function aI(i){return i.t===DO}function lI(i){return i.t===RO}function hI(i){return i.t===Ld}function cI(i){return i.t===NO}function dI(i){return i.t===IO}function uI(i){return i.t===MO}function pI(i){return i.t===VO}function $O(i){let r=i.match(nI),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=oI(t);if(e==="("){let s={t:LO,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:IO,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:MO,v:null});else if(e.match(/\$value/))o.c.push({t:VO,v:null});else if(e.match(/^#/))o.c.push({t:DO,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:NO,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Ld,v:!0});else if(e.match(/false/))o.c.push({t:Ld,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:RO,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:wO,v:e}):rI.indexOf(e)!==-1?o.c.push({t:iI,v:e}):OO.indexOf(e)!==-1?o.c.push({t:OA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Ld,v:!1}),o.c.push({t:OA,v:"=="})):(o.c.push({t:Ld,v:!1}),o.c.push({t:OA,v:"!=="})))}return t[0]}function mI(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(OO.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(GO(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,m;for(let g=1;g<l.length;g+=2)m=l[g],(m.v==="+"||m.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,m],v:null},h.push(p)):p.c.push(u,m):(p!=null?p.c.push(u):h.push(u),p=null,h.push(m)),u=o(l[g+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function Cl(i){let r=$O(i);return mI(r)}function Vi(i,r,e,t,n){let o=jg(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=jg(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function jg(i,r,e,t,n){let o=i.map(l=>GO(l)?jg(l.c,r,e,t,n):sI(l)?r(l.v):aI(l)?e(l.v):dI(l)?r(So)[l.index]:uI(l)?r(vl):pI(l)?r(So):lI(l)||cI(l)||hI(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var Gi=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=$(),r.entries[this.uuid]=this,this.compiledBindings={}}Gd(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:$(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Cl(a),once:s,format:l}})})}}};var Hg=class Hg extends Gi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:$(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.Gd({[Hg.TEXT_BINDING_NAME]:n})}};c(Hg,"TEXT_BINDING_NAME","__element");var $i=Hg;var kg=class kg extends Gi{constructor(e,t){super(t);c(this,"type",kg.type);c(this,"comment");this.comment=e}};c(kg,"type","comment");var Bs=kg;var Wg=class Wg extends Gi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",Wg.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.Gd(e.bindings),this.remove=!1}};c(Wg,"type",ti);var Fr=Wg;var RA={},ni={construct:(i,r,e,t,n,o)=>{let s=RA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{RA[i]=r},exists:i=>RA[i]!=null};var Zg=class Zg extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",ri);this.context=e.atts.in,this.key=e.atts.key,this.tag=Zg.tag}};c(Zg,"tag","r-each");var wd=Zg;ni.register(wd.tag,wd);function Jg(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function LA(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];Jg(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Dd=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[xe]=this.$d(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}$d(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(xe);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[xe];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.$d(n);return this.Bd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[xe]}}Bd(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.Bd(r.children[n],e);r.children=t}};function BO(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function gI(i,r){i.el.nodeValue=r}function EI(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Nd(i,r.children[t]));return e}function Nd(i,r){let e=EI(i,r);return r.type===ti?(i.removeElement(r.el),e.unshift(r.el)):r.type===Mi?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===ri&&(r.entryMap={}),e}function FO(i,r,e,t){for(let n in i.bindings)if(n!==AA){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=Vi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===ti?n!==SA?BO(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);BO(i,u,h.substring(d+1),!0)}):i.type===Mi&&gI(i,a))}}function UO(){return{added:[],removed:[],elements:[]}}var Kg=class Kg extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",Kg.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Cl(this.test)}};c(Kg,"tag","r-if");var Id=Kg;ni.register(Id.tag,Id);function qg(i,r,e,t,n){return i.resolution=Vi(i.entry.expression,o=>Ce(r,o),o=>e(o),t,n),i.resolution}var To=class extends Fr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[yA],this.type=Ao,this.remove=!0,e.atts[Yg])this.lookup=e.atts[Yg],this.default=e.atts[xA]||"";else{this.templateId=e.atts.id;let a=PA(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(To,"tag","r-tmpl"),ni.register(To.tag,To);function YO(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(ar(i)){let e=i;for(let t in e)r(e[t],t)}}var vo=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"Ot",new Map);c(this,"is",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"os");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.os=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Fd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.os[r]!=null?this.os[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.Ot.clear(),this.is.clear()}parseAttributes(r){return zg(r,this.attributesRe)}Ud(r,e){return t=>{let n=e?null:this.Ot.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Ot.set(t,n),n}}addTemplate(r,e){this.os[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.is.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.is.get(r);if(n==null||t===!0){e=this.Ud(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=zO(this,o,e,null,[r]);return this.is.set(r,s),s}}else return n}data(r,e,t){return Ce(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?Ce(e,t.substring(9)):Ce(r,t)}update(r,e,t){let n=r.$recado,o=UO();return t=t||{},n!=null&&this.On(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}On(r,e,t,n,o){if(r.type===bA)for(let s=0;s<r.children.length;s++)this.On(r.children[s],e,t,n,o);else if(r.type===ti||r.type===Mi){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),FO(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Li(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.On(r.children[l],s,t,n,o)}else if(r.type===Tl){let s=r,a=s.resolution,l=qg(s,e,h=>this.Li(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Nd(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.On(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===Ao){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.On(r.children[a],s,t,n)}else if(r.type===ri){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Nd(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];YO(a,(u,p)=>{let m=Ce(u,s.entry.key);if(l[m]=u,s.entryMap[m]!=null){let g=s.entryMap[m];for(let E=0;E<g.length;E++)h.push({data:u,key:m,execution:g[E]})}else h.push({data:u,key:m})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],Nd(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.On(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(m=>{m.el!=null&&s.placeholder.before(m.el)});else{let m=this.render(r.entry.children,p.data,null,n);LA(s,m,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Dd(this,r,e)}parse(r,e,t,n){return zO(this,r,e,t,n)}Li(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:$(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${ri}:${b}`),entryMap:{},type:ri,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${Ao}:${b}`),entry:f,id:b,children:[],type:Ao};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:$(),entry:b,bindings:A,children:[],el:f,type:ti};return h.children.push(S),f.$recado=S,S},m=(f,b,A,T)=>{y(f,T);let S={id:$(),el:f,entry:b,bindings:A,children:[],type:Mi};return h.children.push(S),f.$recado=S,S},g=(f,b,A)=>{let T=$(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${Tl}:${T}`),type:Tl,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,R=null;if(f.type===Tl){let v=h,_=g(f,A,o);if(h=_,S=qg(_,b,P=>this.Li(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,_.placeholder,T);h=v,R=_}else if(f.type===ri){let v=f,_=l,P=f.context===So?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=$(),O=d(v,C,A);h=O,P!=null&&YO(P,(w,B)=>{let N=v.key&&ar(w)?Ce(w,v.key):B||null;for(let M=0;M<f.children.length;M++){let D=x(f.children[M],w,O.placeholder,B);N!=null&&Jg(O,N,D)}}),l=_,h=I,R=O}else if(f.type===Ao){let v=f,_=l,P=h,I=$(),C=u(v,I,A);h=C;let O=f.context==null||f.context.length===0?b:Ce(b,f.context),w=v.lookup!=null?Ce(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,B=this.parseAndCache(w,t);B==null&&v.default!=null&&(B=this.parseAndCache(v.default,t));for(let N=0;N<B.length;N++)x(B[N],O,C.placeholder,T);l=_,h=P,R=C}else if(f.type===ti){let v,_=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let M=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=M.fragment.childNodes[0];let D=M.children[0].bindings;for(let V in D)I[V]=D[V];C.push(...M.children[0].children)}else if(_.namespace!=null&&this.namespaceHandlers[_.namespace])v=this.namespaceHandlers[_.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in _.atts)if(_.atts.hasOwnProperty(N)){let M=_.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:M,type:TA};for(let V=0;V<D.expressions.length;V++){let J=D.expressions[V],ye=Vi(J.expression,j=>j===vl?T:j===So?b:this.lookupValueInDataOrContext(b,n,j),j=>this.Li(j,b,n),J.format,this.formatter);M=M.replace(J.source,ye),I[N].results.push({source:J.source,result:ye})}}this.setAttribute(v,N,M)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let O=l,w=h,B=p(v,_,I,A);B.children.push(...C),h=B,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=O,R=B}else if(f.type===Mi){let v=f.value||"",_={},P=f.compiledBindings[$i.TEXT_BINDING_NAME];if(P!=null){_[$i.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:Mi};for(let O=0;O<P.expressions.length;O++){let w=P.expressions[O],B=Vi(w.expression,N=>N===vl?T:N===So?b:this.lookupValueInDataOrContext(b,n,N),N=>this.Li(N,b,n),w.format,this.formatter);v=v.replace(w.source,B),_[$i.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);R=m(I,f,_,A)}return R};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function fI(i){return ni.exists(i)}function yI(i,r,e,t,n,o){return ni.construct(r,e,i,t,n,o)}function zO(i,r,e,t,n){n=n||[],e=i.Ud(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},m=(E,y,x,f)=>{let b=_A(E,i);return fI(b.el)?yI(i,b.el,b,x,o,n):new Fr(b,i,x,o,n)},g=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new Bs(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==To.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=m(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new $i({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Xg($i.TEXT_BINDING_NAME,E,A,null,f)}}];if(wx(Tt(r).split(i.tokenizerRe),(E,y)=>{let x=Tt(y);for(let f=0;f<g.length;f++){let b=a(x,g[f].re);if(b){g[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function wA(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var Md=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},Qg=class extends Md{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},eE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},tE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var rE=class extends vo{Fd(){return null}ce(r){return new Qg(r)}cf(){return new Md}ctn(r){return new eE(r)}cc(r){return new tE(r)}removeElement(r){}removeTextNode(r){}};function Vd(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function nE(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function DA(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Gd(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let m=u.edge.pathDirection,g=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=m===1?E+1:E-1,f=g===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=m===1?E-1:E+1,S=g===1?y-1:y+1,R=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,_=l.axis===0?Q:Ee,P=b?b.midpoint[_]:R?R.midpoint[_]:p.edge.sourceCenter[_]!==u.edge.sourceCenter[_]?u.edge.sourceCenter[_]:u.edge.targetCenter[_],I=b?A.midpoint[_]:v?v.midpoint[_]:u.edge.sourceCenter[_]!==p.edge.sourceCenter[_]?p.edge.sourceCenter[_]:p.edge.targetCenter[_];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function $d(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,m=s.axis===0?l===1?u.height:0:l===1?u.width:0,g=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+g,[x]:p},b={[y]:d.location+E,[x]:m};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var Bd="separate",xI="bus";function NA(i){let r=i.axis,e=i.gates,t=i.gateMap||Vd(e),n=i.mode||Bd,o=i.regions,s=i.edges,a=i.pad||10,l={};Gd(s,e,t,i.getVertexPosition,i.getVertexSize),$d(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if(DA(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=nE(f,r),T=nE(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,m=r===0?o[h].left:o[h].top,g=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===Bd)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+m,[y]:T.source[y]+g},{[E]:T.source[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:b+g},{[E]:T.target[E]+m,[y]:T.target[y]+g}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let m=p.edgeMap[d.id];l[d.id].push(...m)})}return l}function IA(i){let r=i.gates,e=Vd(r),t=i.regions,n=i.edges,o={};Gd(n,r,e,i.getVertexPosition,i.getVertexSize),$d(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var MA=4;function XO(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var Fs={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=XO(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=XO(s),Fs.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),Fs.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function jO(i){return i.height*i.width}function iE(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function oE(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&oE(i.parent)}function VA(i,r){return i.x===1/0?jO(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-jO(i)}function sE(i){let r=Math.floor(i.children.length/2),e=Co(),t=Co();return Fs.sortRect(i.children).forEach((n,o)=>{o<=r?Po(e,n):Po(t,n)}),i.children.length=0,[e,t]}function Co(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Fd(i){return i.children==null||i.children.length===0}function GA(i){return Fd(i)||Fd(i.children[0])}function Po(i,r){r.parent=i,i.children.push(r),iE(i,r)}function aE(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function HO(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(HO(e)):r.concat(e)},[])}function $A(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function kO(i){i.parent&&(aE(i.parent,i),oE(i.parent))}var Us=class{constructor(r){c(this,"er");c(this,"ne");c(this,"Xr",{});this.er=r||MA,this.ne=Co()}search(r,e){let t=[];return this.zd(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.zd(r,(n,o)=>t.push({node:n,overlap:Fm(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}zd(r,e,t){if(this.ne.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(tt(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(tt(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&Fm(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.ne)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{Sx(r,o)&&(Fd(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.ne),t}insert(r){let e=n=>{let o=this.ne;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.Xr[n.id]=s);!GA(o);)iE(o,s),o=$A(o.children,a=>VA(a,s));Po(o,s),this.NE(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}NE(r){let e=r;for(;e.parent&&e.parent.children.length>this.er;)e=e.parent,e!=this.ne?(aE(e.parent,e),sE(e).forEach(t=>{Po(e.parent,t)})):e==this.ne&&sE(e).forEach(t=>{Po(e,t)})}Yd(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.er),n=[],o=0,s;for(let a=0;a<t;a++){s=Co(),o=Math.min(this.er,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.Xr[h.id]=h),Po(s,h)}n.push(s)}return t>1?this.Yd(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=Fs.sortRect(r);this.ne=this.Yd(e)[0]||Co()}}getBounds(){return{x:this.ne.x,y:this.ne.y,width:this.ne.width,height:this.ne.height}}getExtents(){return{xmin:this.ne.x,ymin:this.ne.y,xmax:this.ne.x+this.ne.width,ymax:this.ne.y+this.ne.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.Xd(e),e}Xd(r,e){let t=[],n=r.parent;for(kO(r),r.id!=null&&delete this.Xr[r.id];n!=null&&n!==this.ne;)n.children.length<=this.er/2&&(kO(n),t.push(...this.IE(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.Xr[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.Xd(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.ne=Co(),this.Xr={}}getLeafNodes(){return Object.values(this.Xr)}has(r){return this.Xr.hasOwnProperty(r)}IE(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Ud=class i{constructor(r){this.instance=r;c(this,"de",[]);c(this,"Q",[]);c(this,"ee",[])}static from(r){let e=new i(r.instance);return e.de=r.de.slice(),e.Q=r.Q.slice(),e.ee=r.ee.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.ME(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,Yx,null))}),s}ME(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(g){let E=r.getCoordinates(g,!0);u.set(g.id,E),g.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.Q.forEach(p),this.de.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let m=(g,E,y)=>{y=y||0;let x=Object.assign({},g.data),f=$();if(o.vertexMap.set(g.getFullId(),f),x.id=f,E==null){let b=u.get(g.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x.group!=null&&delete x.group}else x.group=E.id;return!n&&Y(g)&&g.getMembers().forEach(b=>{let A=m(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.de.forEach(g=>o.nodes.push(m(g,null,0)[0])),this.Q.forEach(g=>s.push(m(g,null,0))),s.sort((g,E)=>g[1]<E[1]?-1:1),o.groups=s.map(g=>g[0]),this.ee.forEach(g=>{let E,y,x=g.source,f=H(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=g.target,T=H(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let R={source:E,target:y,data:Object.assign({},g.data||{})};if(R.data.id!=null){let v=$();o.edgeMap.set(R.data.id,v),R.data.id=v}g.geometry!=null&&S!=null&&b!=null&&(R.geometry=r.transformGeometry(g,o.transform.x,o.transform.y)),o.edges.push(R)}),o}};var Yd=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Ud.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var lE="Anchor",Ct="top",Pt="left",_t="right",Ot="bottom",hE={[Ct]:{x:0,y:-1},[Ot]:{x:0,y:1},[_t]:{x:1,y:0},[Pt]:{x:-1,y:0}},bI=[Pt,_t],AI=[Ct,Ot],SI={[Ct]:[Pt,_t],[Ot]:[Pt,_t],[Pt]:[Ot,Ct],[_t]:[Ot,Ct]},TI={[Ct]:Ot,[Ot]:Ct,[Pt]:_t,[_t]:Pt},WO=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(WO||{}),Pl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(Pl||{});var vn={};function Ys(i,r){vn[i]=r}var dr={lineIntersection(i,r,e,t,n){return vn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return vn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return vn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return vn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return vn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return vn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return vn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return vn[i.type].getPath(i,r)}};function cE(i){return vn[i.type].getLength(i)}function BA(i,r){return vn[i].create(r)}function vI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function FA(i,r,e){return vI()}function UA(i,r,e,t,n){return[]}function _l(i,r,e,t,n){let o=[];return o.push.apply(o,dr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,dr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,dr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,dr.lineIntersection(i,r,e+n,r,e)),o}function YA(i,r){return _l(i,r.x,r.y,r.width,r.height)}function zs(i){return Object.assign({extents:vi()},i)}function ZO(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:Q,stubs:[0,0]}}function Xs(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function zd(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:vi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:ZO()}}function dE(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var zA=.45,JO=62;function Xd(i,r,e){let t=zd(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||JO,isLoopbackCurrently:!1,constrain:qr,smooth:!0})}var ii={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},KO=64,CI=Math.pow(2,-KO-1);function eR(i,r){let e=[],t=PI(i,r),n=r.length-1,o=2*n-1,s=XA(t,o,e,0),a=ii.subtract(i,r[0]),l=ii.square(a),h=0,d;for(let u=0;u<s;u++)a=ii.subtract(i,jA(r,n,e[u],null,null)),d=ii.square(a),d<l&&(l=d,h=e[u]);return a=ii.subtract(i,r[n]),d=ii.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function WA(i,r){let e=eR(i,r);return{point:jA(r,r.length-1,e.location,null,null),location:e.location}}function PI(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=ii.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=ii.subtract(r[u+1],r[u]),o[u]=ii.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=ii.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),m=Math.min(u,h);for(let g=p;g<=m;g++){let E=u-g;a[g+E].y+=s[E][g]*l[E][g]}}return a}function XA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(_I(i,r)){case 0:return 0;case 1:{if(t>=KO)return e[0]=(i[0].x+i[r].x)/2,1;if(OI(i,r))return e[0]=RI(i,r),1;break}}jA(i,r,.5,n,o),s=XA(n,r,l,t+1),a=XA(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function _I(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function OI(i,r){let e,t,n,o,s,a,l,h,d,u,p,m,g,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,m=1,g=0,E=a,y=l,x=h-f,d=p*y-E*m,u=1/d,t=(m*x-y*g)*u,E=a,y=l,x=h-b,d=p*y-E*m,u=1/d,n=(m*x-y*g)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<CI?1:0}function RI(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function jA(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function LI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(wI(t/i,r));return e}function wI(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function ZA(i){let r=0;if(!kA(i)){let t=LI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=HA(o,s)}}return r}var qO=new Map;function DI(i){let r=qO.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),qO.set(i,r)}return r}function js(i,r){let e=DI(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function HA(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function kA(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function jd(i,r,e){if(kA(i))return{point:i[0],location:r};let t=js(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=js(i,o),n+=HA(a,t),t=a;return{point:a,location:o}}function JA(i,r,e){return jd(i,r,e).point}function KA(i,r,e){return jd(i,r,e).location}function Hd(i,r){let e=js(i,r),t=js(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function NI(i,r,e){let t=jd(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Hd(i,t.location)}function II(i,r,e,t){t=t==null?0:t;let n=jd(i,r,t),o=Hd(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function Cn(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=GI(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=$I.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let m=d[p],g=Math.pow(m,2),E=Math.pow(m,3),y={x:l[0][0]*E+l[0][1]*g+l[0][2]*m+l[0][3],y:l[1][0]*E+l[1][1]*g+l[1][2]*m+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),m>=0&&m<=1&&x>=0&&x<=1&&u.push(y)}return u}function MI(i,r,e,t,n){let o=[];return o.push.apply(o,Cn(i,r,i+e,r,n)),o.push.apply(o,Cn(i+e,r,i+e,r+t,n)),o.push.apply(o,Cn(i+e,r+t,i,r+t,n)),o.push.apply(o,Cn(i,r+t,i,r,n)),o}function VI(i,r){let e=[];return e.push.apply(e,Cn(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Cn(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Cn(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Cn(i.x,i.y+i.height,i.x,i.y,r)),e}function QO(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function GI(i){return[QO(i,"x"),QO(i,"y")]}function $I(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let m=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(m/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((m+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((m+4*Math.PI)/3)-n/3}for(let m=0;m<3;m++)(p[m]<0||p[m]>1)&&(p[m]=-1);return p}var _o="Bezier";function qA(i,r,e){return e&&(r=KA(i,r>0?0:1,r)),r}var tR={create(i){let r=zs(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:_o})},boundingBoxIntersection(i,r){return YA(i,r)},boxIntersection(i,r,e,t,n){return _l(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=WA({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=ZA(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=qA(i.curve,r,e),Hd(i.curve,r)},lineIntersection(i,r,e,t,n){return Cn(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=qA(i.curve,r,t),JA(i.curve,r,e)},pointOnPath(i,r,e){return r=qA(i.curve,r,e),js(i.curve,r)}};Ys(_o,tR);var kd={};function BI(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function rR(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function FI(i){return!i.source||!i.target||!rR(i.source)||!rR(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!BI(r))==null}var Ur=i=>lt(i.geometry),Ge={get:(i,r,e)=>{let t=kd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{kd[i]=r},compute:(i,r,e)=>{let t=kd[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=kd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},markEdited(i,r){r=r||Ur(i.connector),i.connector.edited=!0,i.edge.geometry=r,Ge.$_setAnchorsFromGeometry(i,r)},importGeometry(i,r){if(FI(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,Ge.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){dE(r.source,i,0),dE(r.target,i,1)},transformGeometry(i,r,e,t){let n=kd[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=Ur(t))}}};function UI(i){return i.geometry}function YI(i,r){return i.geometry=r,!0}function iR(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function pE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function Yr(i,r,e){if(e.x1===e.x2&&e.y1===e.y2)return;let t=BA(r,e);i.internalSegments.push(t),i.totalLength+=cE(t),iR(i,t)}function uE(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function ur(i,r,e){let t=uE(i,r,e);return t.segment&&dr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function zI(i,r,e){let t=uE(i,r,e);return t.segment&&dr.gradientAtPoint(t.segment,t.proportion,!1)||0}function $e(i,r,e,t){let n=uE(i,r,t);return n.segment&&dr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function mE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=cE(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function nR(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function gE(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),m=Math.abs(o-n),g=!nR(r.sourcePos),E=!nR(r.targetPos);if(g||E){let S=p>m,R=S?e:n,v=S?t:o,_=R>v?-1:1,P=R>v?1:-1;g&&(l.x=S?_:0,l.y=S?0:_),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:m,quadrant:ms({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?Ee:Q,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function XI(i,r){let e=i.connector;e.paintInfo=gE(e,r),pE(e),Ge.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,mE(e)}function Bi(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function QA(i){i.bounds=vi()}function eS(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=dr.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function jI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,dr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function HI(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,dr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function tS(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,dr.boundingBoxIntersection(i.internalSegments[t],r));return e}function kI(i){return i.typeDescriptor==="connector"}function rS(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=dr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function WI(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,m,g;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;m={x:E,y},g={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;m={x:r.sx+x,y:r.sy+f},g={x:r.tx+b,y:r.ty+A}}return[m,g]}function ZI(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=WI(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function oR(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function JI(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,m=(l+d)/2,g=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=KI(p,m,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,g,i.proximityLimit),[u,u]}function KI(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function sR(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Wd(i,r,e,t,n){let o=i.connector,s,a;o.type===Oo?[s,a]=sR(o):[s,a]=oR(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return Yr(o,_o,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Zd(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===Oo?t.edited?[l,h]=sR(t):[l,h]=ZI(t,r,e,n,o,s,a):t.edited?[l,h]=oR(t):[l,h]=JI(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return Yr(t,_o,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function Jd(i,r,e){return{source:Xs(i.source,r,e),target:Xs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var Oo="Bezier";function aR(i,r){let e=Xd(Oo,i,r);return Object.assign(e,{scale:r.scale||zA})}Ge.register(Oo,{compute:Zd,update:Wd,create:aR,transformGeometry:Jd});var Kd="QuadraticBezier";function lR(i,r){let e=Xd(Kd,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",cA:{x:0,y:0}})}Ge.register(Kd,{compute:Zd,update:Wd,create:lR,transformGeometry:Jd});var EE="perpendicular",fE="orthogonal",yE="opposite",Hs="Orthogonal",nS="Smooth",iS=30;function Ol(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function oS(i,r,e){return qd(r,"h",e,1)}function sS(i,r,e){return qd(r,"h",e,-1)}function aS(i,r,e){return qd(r,"v",e,1)}function lS(i,r,e){return qd(r,"v",e,-1)}function qd(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function Qd(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function eu(i,r,e,t){let n=i.indexOf(t),o=Qd(i,r,e,t);return o&&o[1]==n+r?o:null}function Ro(i){return{[re]:Math.sign(i.x2-i.x1),[ue]:Math.sign(i.y2-i.y1)}}function xE(i,r){return i.curX===r.curX&&i.curY===r.curY}function Rl(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?ue:re;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function hS(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===re){if(Ol(t.x2,i[0].x1,i[0].x2)||sr(o,r).length>0){let a=aS(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:ue}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:ue}),a.segment.y1=h}}}}else if(t.o===ue&&(Ol(t.y2,i[0].y1,i[0].y2)||sr(o,r).length>0)){let a=oS(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:re}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:re}),a.segment.x1=h}}}return n}function cS(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===re){if(Ol(n.x1,a.x1,a.x2)||sr(s,r).length>0){let h=lS(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:ue}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(m=>{m.y1=u,m.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:ue}),h.segment.y2=u}}}}else if(n.o===ue&&(Ol(n.y1,a.y1,a.y2)||sr(s,r).length>0)){let h=sS(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(m=>{m.x1=u,m.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:re}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(m=>{m.x1=u,m.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:re}),h.segment.x2=u}}}return o}function dS(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=cS(r,t,i.targetStub),s=hS(r,e,i.sourceStub)):(s=hS(r,e,i.sourceStub),o=cS(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var Pn="Straight";function oi(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function bE(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function AE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Lo={create(i){let r=zs(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Dr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:Pn})},boundingBoxIntersection(i,r){return Lo.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Lo.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Lo.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Lo.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Lo.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=bE(i.x1,i.x2,r)?r:AE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=bE(i.y1,i.y2,e)?e:AE(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=bE(i.x1,i.x2,a)?a:AE(i.x1,i.x2,a),t.y=bE(i.y1,i.y2,l)?l:AE(i.y1,i.y2,l)}let n=Fe({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Fe({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Dr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)oi(r,i.x1,i.x2)&&oi(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)oi(e,i.y1,i.y2)&&oi(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,oi(d,i.x1,i.x2)&&(u=s*r+a,oi(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,oi(u,i.y1,i.y2)&&(d=(e-a)/s,oi(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,oi(d,i.x1,i.x2)&&oi(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Lo.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),Xt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return Xt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};Ys(Pn,Lo);var hR=1e-10;function cR(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<hR?r:e-i<hR?e:i}var Ll="Arc";function dR(i,r,e,t){return Ka({x:i,y:r},{x:e,y:t})}function qI(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+Si:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+Si:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var tu={create(i){let r=zs(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=dR(e,t,r.x1,r.y1),a=dR(e,t,r.x2,r.y2)),a<0&&(a+=Si),s<0&&(s+=Si);let l=a<s?a+Si:a,h=Math.abs(l-s);o&&(h=Si-h);let d=2*Math.PI*n,u=h/Si,p=d*u,m={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:m,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Ll})},boundingBoxIntersection(i,r){return tu.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return _l(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return FA(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=tu.pointOnPath(i,r,e),n=Ax({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return UA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=tu.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=qI(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:cR(n),y:cR(o),theta:t}}};Ys(Ll,tu);var uR={x:[Q,Ee],y:[Ee,Q]};function pR(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var wl=new Map;wl.set(EE,pR),wl.set(fE,pR),wl.set(yE,(i,r)=>{let e=i,t=e.sourceAxis,n={[Q]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[Ee]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[Q]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[Ee]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var Dl=new Map;Dl.set(EE,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},m={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},g={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=uR[e][0],f=uR[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],R=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&R<S)return m[e];if(i.quadrant===v[2]&&R>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return g[e]}),Dl.set(fE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[Ee]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[Q]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[Ee]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Dl.set(yE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[Q]:Ee,[Ee]:Q}[e],u=e===Q?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[Q]:Ne,[Ee]:ve}[e],m=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[Q]:[{x:t,y:m},{x:o,y:m}],[Ee]:[{x:m,y:t},{x:m,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[Q]:[{x:t,y:l},{x:o,y:l}],[Ee]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[Q]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[Ee]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function uS(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=wl.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===Q?0:1,l=r.sourceAxis===Q?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];Rl(t,s[0],s[1],r,n,o);let m=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,g=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Dl.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,m,g,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)Rl(t,y[x].x,y[x].y,r,n,o);return Rl(t,s[2],s[3],r,n,o),Rl(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function ru(i,r){let e=r;return i.smooth===!0&&e.length>=2?tM(i,e).map(n=>Yr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?QI(i,e):e.map(t=>Yr(i,Pn,t)),i.$pathSegments=e,e}function pS(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function mS(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function QI(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=pS(e),o=pS(t),i.cornerRadius>0&&n!==o){let a=Math.min(mS(e),mS(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=wt({x:e.x1,y:e.y1},h,1e4),m=wt({x:t.x1,y:t.y1},d,1e4),g=Ym(p,m),E=g!=null?Fe(g,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,Yr(i,Pn,Object.assign({},e)),i.slightlyWonky?Yr(i,Ll,Object.assign({r:l,cx:g.x,cy:g.y,ac:u>0},e)):Yr(i,Ll,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:g.x,cy:g.y,ac:u>0})):Yr(i,Pn,Object.assign({},e))}else Yr(i,Pn,Object.assign({},e));e=t}t!=null&&Yr(i,Pn,Object.assign({},e))}var eM=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},mR=(i,r,e,t,n)=>{let a=eM(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function SE(i,r){let e=[];for(let t=1;t<i.length;t++){let n=mR(i[t-1],i[t-2],i[t],r),o=mR(i[t],i[t-1],i[t+1],r,!0);e.push({type:_o,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function tM(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),SE(e,i.smoothing)}function gR(i,r,e){return TE([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function nu(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===Qr?gS(s,a,o,r,e,t,n):rM(s,a,o,r.quadrant,t,n),ru(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function iu(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===Qr?t.$pathSegments=uS(t,r,e):t.$pathSegments=gR(t,r,e),ru(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function rM(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function ou(i,r,e){return{source:Xs(i.source,r,e),target:Xs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function TE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var ER=.15,_n="Straight";function ks(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}Ge.register(_n,{compute:iu,update:nu,create:ES,transformGeometry:ou});function nM(i,r){let e=Object.assign(r,{constrain:Qr});return ES(i,e)}Ge.register(Hs,{compute:iu,update:nu,create:nM,transformGeometry:ou});function iM(i,r){let e=Object.assign(r,{constrain:qr,smooth:!0});return ES(i,e)}Ge.register(nS,{compute:iu,update:nu,create:iM,transformGeometry:ou});function oM(i){return i==null?null:i===Hx?Qr:i===kx?Lc:i}function ES(i,r){let e=oM(r.constrain);r.stub=r.stub==null?e===Qr?iS:null:r.stub;let t=zd(_n,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?ER:r.smoothing,geometry:{segments:[]},constrain:e==null?qr:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function yS(i,r,e){fS(1,i,r,e),fS(0,i,r,e)}var wo="x2",Do="x1",No="y1",Io="y2";function sM(i,r,e){let t=e===i.x1?{value:i.x2,coord:wo,prev:!0}:{value:i.x1,coord:Do,prev:!0},n=e===r.x1?{value:r.x2,coord:wo,prev:!1}:{value:r.x1,coord:Do,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function aM(i,r,e){let t=e===i.y1?{value:i.y2,coord:Io,prev:!0}:{value:i.y1,coord:No,prev:!0},n=e===r.y1?{value:r.y2,coord:Io,prev:!1}:{value:r.y1,coord:No,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function fR(i,r){if(r.length<5)return r;function e(d,u,p){let m=p===d.x1?d.x2:d.x1,g=p===u.x1?u.x2:u.x1;if(m>u.x1&&u.x2>m||m>u.x2&&u.x1>m)return m;if(g>d.x1&&d.x2>g||g>d.x2&&d.x1>g)return g}function t(d,u,p){let m=p===d.y1?d.y2:d.y1,g=p===u.y1?u.y2:u.y1;if(m>u.y1&&u.y2>m||m>u.y2&&u.y1>m)return m;if(g>d.y1&&d.y2>g||g>d.y2&&d.y1>g)return g}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Ro(n)[n.o],o.o!==n.o)if(ks(o)<a){let p=r[d+1];if(Ro(p)[p.o]!==s){let g=Object.assign({},o);if(o.o===ue){let E=sM(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(g.x1=y,g.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,g]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}else if(o.o===re){let E=aM(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(g.y1=y,g.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,g]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[g,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?vE(h):h}function fS(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?wo:Do,p=i===1?Io:No,m=i===1?Do:wo,g=i===1?No:Io,E=1,y=n.length-2,x=1,f=n[1];o[m]=l+a*d.x,o[g]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Ro(o),A=o.o,T=o.o===re?ue:re,S=o.o===re?[wo,Do]:[Io,No],R=o.o===re?[Do,wo]:[No,Io],v=o.o===re?[Io,No]:[wo,Do],_=o.o===re?[No,Io]:[Do,wo],P=S[i],I=R[i],C=v[i],O=_[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[O]=o[C];let B=Ro(f)[A],N=eu(n,x,T,f);if(B!==b[A]){if(N!=null){let M=eu(n,x,A,N[0]);if(M!=null)n.splice(E,1),M[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][O]=o[C];else{let D=(N[0][C]+N[0][O])/2;N[0][O]=D,f[C]=f[O]=D;let V={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[O]:o[C],[I]:o[P]};n.splice(E,0,V)}}}else if(f[C]=f[O]=o[C],N!=null)N[0][O]=o[C];else if(f[C]!==s[O]){let M={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[O]:f[O]},D=n.length-1;n.splice(D,0,M)}}else{f[O]=o[C],f[P]=f[I]=o[P];let B=eu(n,x,A,f);if(B!=null){let N=Ro(B[0])[A];B[0][I]=o[P];let M=Ro(B[0])[A];if(N!==M&&B[1]===y){n.splice(B[1],1);let D=(f[C]+f[O])/2;f[O]=D,f[P]=f[I]=s[I];let V={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[O]:D,[I]:o[P]};n.splice(E,0,V);let J={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[O]:o[C],[I]:o[P]};n.splice(E,0,J)}}else{let N=(f[C]+f[O])/2;f[O]=N,f[P]=f[I]=s[I];let M={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[O]:N,[I]:o[P]};n.splice(E,0,M);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[O]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=fR(r,n);i===1&&w.reverse(),r.$pathSegments=w}function gS(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(m=>{let g=Object.assign({},m);g.x1+=l,g.x2+=l,g.y1+=h,g.y2+=h,p.push(g)}),e.$pathSegments=p;return}yS(e,t,n)}}function lM(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?Qd(i,-1,n,o):null,right:e?Qd(i,1,n,o):null}}else return null}function xS(i,r,e,t,n){let o=lM(r.$pathSegments,e);if(o!=null){o.axis===ue?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===ue,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let m={o:re,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}else if(d.y1!==r.$pathSegments[0].y2){let m={o:ue,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,m),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let m={o:re,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}else if(d.y2!==p.y1){let m={o:ue,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,m)}if(n!==!0){let m=i.instance.getElement(i.sourceId),g=i.instance.getElement(i.targetId);dS(r,r.$pathSegments,m,g,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function vE(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>ks(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===re?ue:re,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===re?ue:re,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function bS(i){let r=vE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var su=class extends Gt{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire(El,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(El,{key:e,value:t})}};var Fi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Fi||{});var On="px",zr="50px",Cr="block",pt="none",Ke="absolute",CE="fixed",AS="static",SS="relative",hM="data-vjs-group",mt="data-vjs-managed",Nl="data-vjs-not-draggable",TS="data-vjs-elements-draggable",PE="tabindex",te="data-vjs-vertex",rn="data-vjs-port",Il="data-vjs-port-id",Xr="data-vjs-port-type",au="data-vjs-edge-type",vS="data-vjs-source",Mo="data-vjs-target",_E="data-vjs-allow-loopback",OE="data-vjs-source-port-id",lu="data-vjs-target-port-id",Ws="data-vjs-source-port",Vo="data-vjs-target-port",Ui="data-vjs-source-port-type",Yi="data-vjs-target-port-type",hu="data-vjs-magnet",qe="data-vjs-edge",cu="data-vjs-overlay-id",pr="*";var Zs="vjs-connector",CS="vjs-connector-path",PS="vjs-connector-outline",_S="vjs-connector-transient",Ml="vjs-connected",RE="vjs-group-collapsed",LE="vjs-group-expanded",du="vjs-toggle-group-collapse",Js="vjs-overlay",Vl="vjs-overlay-hide",OS="vjs-label-overlay",zi="vjs-node",RS="vjs-port",Go="vjs-group",LS="vjs-dummy-vertex",Gl="vjs-selected-connection",Xi="vjs-selected-element",Ks="vjs-edge-delete",uu="vjs-edge-delete-i";var wE="allowNestedGroups",$l="anchor",Bl="anchors",wS="astarVertexBorder",DS="astarVertexBuffer",cM="edgesDetachable",pu="connector",NS="cssClass",IS="edgeRelocateHandleSize",dM="groupSize",MS="hoverClass",mu="hoverPaintStyle",VS="maxConnections",uM="nodeSize",$o="paintStyle",pM="reattachEdges",DE="scope",GS=[.05,3];function $S(i){return i.type!=null&&i.options!=null}function ai(i){let r=null;return X(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||$(),r}var gu="always",ji="hover";function NE(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var si=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"ss");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||$(),this.cssClass=e.cssClass||"",NE(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.ss=r.instance.$isTouchDevice()?gu:e.visibility||gu,this.ss===ji&&(this.visible=!1)}},Rn=class extends si{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var yR={},at={get:(i,r,e,t)=>{let n=yR[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{yR[i]=r}};var IE=class IE extends si{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",IE.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return mn(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&NE(this,e.location),ME(this,t)}};c(IE,"type","Label");var mr=IE;function jr(i){return i.type===mr.type}at.register(mr.type,mr);function ME(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var VE="labelLocation",mM=[$l,Bl,"cssClass",pu,$o,mu],gM="parent";function Eu(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[gM],p;if(Array.isArray(u)?p=u:p=[u],p.find(g=>d.indexOf(g)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(g=>e(g)).filter(g=>g!=null)}},n=(h,d,u)=>{let p=mM.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let m=gn(h,d,[],p);return o(t(h,u),m,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let m=0;m<h.length;m++)p=n(h[m],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function qs(i){return(r,e,t)=>{let n=Ac(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function BS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=qs(i.anchorPositions))}var fu=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if($S(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=Eu([r,xe],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:mr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||VE;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||Ks)+" "+uu,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:mr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===ji?ji:gu}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=Eu([r,xe],this.nodes);return delete e.parent,BS(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=Eu([r,xe],this.ports);return delete e.parent,BS(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=Eu([r,xe],this.groups);return delete e.parent,BS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(K(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(H(r))return this.getPortDefinition(e)}};function yu(){return new Set}var xR=class{constructor(){c(this,"affectedElements",new Set)}};function AR(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function EM(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>De({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),m=d(r+t,e+n),g=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,m.x,g.x),x=Math.max(u.x,p.x,m.x,g.x),f=Math.min(u.y,p.y,m.y,g.y),b=Math.max(u.y,p.y,m.y,g.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var GE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},bR=(i,r)=>GE(i,r)*-1;function $E(i,r,e,t,n){km({id:i,value:r,otherBound:e},t,GE,n)}function Bo(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var xu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"jd",null);c(this,"rtree");c(this,"Xe",!1);c(this,"ka",!0);c(this,"P",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"M",{});c(this,"Wa",{});c(this,"je",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Us(4)}setSuspended(r){this.Xe=r,this.Xe||(this.recomputeBounds(),this.VE())}getExtents(){return Object.assign({},this.je)}GE(r,e,t){e!=null&&(Bo(r,this.P.xmin),Bo(r,this.P.xmax),Bo(r,this.P.ymin),Bo(r,this.P.ymax),$E(r,e.t.x,e.t.x2,this.P.xmin,!1),$E(r,e.t.x2,e.t.x,this.P.xmax,!0),$E(r,e.t.y,e.t.y2,this.P.ymin,!1),$E(r,e.t.y2,e.t.y,this.P.ymax,!0),t!==!0&&this.as())}as(){this.je.xmin=this.P.xmin.length>0?this.P.xmin[0].value:0,this.je.xmax=this.P.xmax.length>0?this.P.xmax[0].value:0,this.je.ymin=this.P.ymin.length>0?this.P.ymin[0].value:0,this.je.ymax=this.P.ymax.length>0?this.P.ymax[0].value:0}recomputeBounds(){if(this.ka){this.ka=!1,this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0;for(let r in this.M){let e=this.M[r];this.P.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.P.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.P.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.P.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.P.xmin.sort(GE),this.P.ymin.sort(GE),this.P.xmax.sort(bR),this.P.ymax.sort(bR),this.as()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.M[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.M[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(n.indexOf(l.id)===-1&&zm(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.M[l.id];if(zm(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.M[d]),t))return s}}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=Cx(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}$E(r,e,t){e.t=EM(r,e.x,e.y,e.width,e.height,e.r),this.Wa[r]=e.t,this.ka=!0,t!==!0&&(this.Xe||this.GE(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Xe||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=ys(this.M,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=De({x:h.x,y:h.y},h.c,h.r),this.jd==null?this.$E(r,h,l):this.jd.affectedElements.add(r)),h}$forEachElement(r){for(let e in this.M)r(this.M[e])}$refreshEveryElement(){for(let r in this.M)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.M[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==ce.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}BE(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.je.xmax-this.je.xmin}getBoundsHeight(){return this.je.ymax-this.je.ymin}getX(){return this.je.xmin}getY(){return this.je.ymin}setSize(r,e,t){if(this.M[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.M[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.M[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0,this.M={},this.Wa={},this.rtree.clear(),this.as()}remove(r){Bo(r,this.P.xmin),Bo(r,this.P.xmax),Bo(r,this.P.ymin),Bo(r,this.P.ymax),delete this.M[r],delete this.Wa[r],this.rtree!=null&&this.rtree.removeById(r),this.as()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,m,g,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((m=u.t)==null?void 0:m.x)||u.x,T=((g=n[u.id])==null?void 0:g.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,R=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+R)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}VE(){this.rtree.clear();let r=Object.values(this.M).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.M[r]}getElements(){return this.M}isEmpty(){return Object.keys(this.M).length===0}getElement(r){return this.M[r]}getElementPosition(r){return this.M[r]!=null?Nt(this.M[r]):null}getElementSize(r){return this.M[r]!=null?kn(this.M[r]):null}getElementBounds(r){return this.M[r]!=null?Object.assign(Nt(this.M[r]),kn(this.M[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=AR(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.M[r]=l,Y(t)){let m=a;m.collapsed=!1,m.enabled=!0,m.contentArea=this.instance.$getGroupContentAreaElement(e),m.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(m.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var fM="currentFace",SR={[Ct]:Ot,[_t]:Pt,[Pt]:_t,[Ot]:Ct},TR={[Ct]:_t,[_t]:Ot,[Pt]:Ct,[Ot]:Pt},vR={[Ct]:Pt,[_t]:Ct,[Pt]:Ot,[Ot]:_t};function Fl(i,r){return i.faces.indexOf(r)!==-1}function yM(i,r){return(i.clockwise?TR:vR)[r]}function xM(i,r){return(i.clockwise?vR:TR)[r]}function BE(i,r,e){let t=()=>Fl(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function bM(i,r){if(Fl(i,r))return r;if(Fl(i,SR[r]))return SR[r];{let e=yM(i,r);if(Fl(i,e))return e;{let t=xM(i,r);if(Fl(i,t))return t}}return r}function FS(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:$(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,Hd:null};return Object.defineProperty(t,fM,{get(){return this.Hd},set(n){this.Hd=bM(this,n)}}),t}var US={Continuous:{faces:[Ct,Pt,Ot,_t]},ContinuousTop:{faces:[Ct]},ContinuousRight:{faces:[_t]},ContinuousBottom:{faces:[Ot]},ContinuousLeft:{faces:[Pt]},ContinuousLeftRight:{faces:[Pt,_t]},ContinuousTopBottom:{faces:[Ct,Ot]}};function AM(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var CR={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},PR={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},_R={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},OR={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},SM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},TM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},vM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},CM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},PM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},RR={Top:[CR],Bottom:[PR],Left:[_R],Right:[OR],TopLeft:[SM],TopRight:[TM],BottomLeft:[vM],BottomRight:[CM],Center:[PM],AutoDefault:[CR,_R,PR,OR]};function LR(i,r){r=r||{};let e=RR[i];if(e!=null)return FE(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=US[i];if(t!=null)return FS(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function FE(i,r,e,t){return{objectType:lE,type:i,locations:r,currentLocation:0,id:$(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function wR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function bu(i,r,e){let t=At(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&AM(t,e),t}function _M(i){return i.objectType===lE}function At(i,r){if(_M(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),X(i)){let e=LR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(wR(i))return FE(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(X(t)){let n=RR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(wR(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return FE("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return LR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var OM="___sourceMarker",RM="___targetMarker",Su="__label",jS="vjs-default-label",YS="overlay",NR="labelLocation";function LM(i,r){let e=null;if(X(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||$(),Le.cacheTypeItem(i,YS,e,e.id),i.overlays[e.id]=e,e}function Ul(i,r){let e=LM(i,r);if(e.type===mr.type&&!X(r)){let t=e,o=r.options.labelLocationAttribute||NR,s=i.edge.data[o];s&&(t.location=s),ME(t,i.edge.data)}return e}function YE(i,r){return i.overlays[r]}function IR(i){return i.overlays}function MR(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function VR(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function Fo(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function wM(i){return YE(i,Su)}var zS="add",XS="remove",Au="anchors",UE="connector";function DR(i,r,e){for(let t in i.overlays)r===zS?i.instance.$addOverlayClass(i.overlays[t],e):r===XS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function HS(i,r,e){let t=null;r.connector!=null&&(t=Le.getCachedTypeItem(i,UE,e.connector),t==null&&(t=qt.kd(i,r.connector,e.connector),Le.cacheTypeItem(i,UE,t,e.connector)),qt.setPreparedConnector(i,t)),Le.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=Le.getCachedTypeItem(i,YS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.ss!==ji&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Ul(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&Fo(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=Le.getCachedTypeItem(i,Au,e.anchor),s==null&&(s=[At(r.anchor),At(r.anchor)],Le.cacheTypeItem(i,Au,s,e.anchor))):r.anchors&&(s=Le.getCachedTypeItem(i,Au,e.anchors),s==null&&(s=[At(r.anchors[0]),At(r.anchors[1])],Le.cacheTypeItem(i,Au,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Hr(i,r){Le.addClass(i,r),DR(i,zS,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Pr(i,r){Le.removeClass(i,r),DR(i,XS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var qt={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&Le.cacheTypeItem(i,UE,r,n),Hr(i,s),o!=null){let a=IR(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,Le.destroy(i)},setVisible(i,r){Le.setVisible(i,r),r?VR(i):MR(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},kd(i,r,e){let t={},n;if(X(r))n=Ge.get(i,r,t);else{let o=r;n=Ge.get(i,o.type,gn(o.options||{},t))}return e!=null&&(n.typeId=e),n},Wd(i,r,e,t,n){let o=qt.kd(i,r,n);qt.setPreparedConnector(i,o,e,t,n)}};function kS(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function GR(i,r,e){for(let t in r)i[t]=e}var DM="connector",NM="override",IM="cssClass",$R="__default",MM="anchor",VM="anchors";function zE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return GR(e,t,$R),i.$types.forEach(o=>{if(o!==$R){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([DM,MM,VM]);if(s.mergeStrategy===NM)for(let l in s)a.add(l);n=gn(n,s,[IM],Array.from(a)),GR(e,s,o)}}}),r&&(n=uo(n,r,"_")),Qs(i)&&HS(i,n,e),e}function Qs(i){return i.objectType===XE}var XE="connection";function WS(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&Qs(i)&&Pr(i,e.cssClass)}function Tu(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var GM="add",$M="remove";function ZS(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||$(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var Le={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=kS(r),n=!1,o=s=>i.$types.has(s)?(WS(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&zE(i,e)}},addType(i,r,e){let t=kS(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&zE(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,Tu(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,Tu(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{WS(i,e)}),i.$types.clear(),zE(i,r)},setType(i,r,e){return Le.clearTypes(i),(kS(r)||[]).forEach(i.$types.add,i.$types),zE(i,e)},applyType(i,r,e){Le.setPaintStyle(i,r.paintStyle),Le.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function BR(i,r){return r.theta-i.theta}function FR(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var JS={[Ct]:FR,[_t]:BR,[Ot]:BR,[Pt]:FR};function KS(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,m=i.x+p,g=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=De({x:m,y},i.c,i.r);m=f.x,y=f.y}a.push({x:m,y,xLoc:g,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Uo(i){return!i.isFixed&&i.isContinuous===!0}function qS(i){return[i.currentLocation,i.locations[i.currentLocation]]}function BM(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=wt(i,o,n),a=wt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function vu(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=De(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function UR(i,r,e,t,n,o,s,a){let l=Nr(r),h=pb(r),d=s(e,t,l,h);d.sort((p,m)=>{let g=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=m.axis===l&&m.directionFromParent===r.directionFromParent,x=m.axis===l&&m.directionFromParent!==r.directionFromParent;return g||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let m=d[p],g=e+m.dx,E=t+m.dy,y=m.axis,x=m.directionFromParent,f=r.ax+m.dx*n,b=r.ay+m.dy*n,A=i.getCell(g,E,null,null),T=A===a,S={cx:g,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(g-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function QS(i){let r=[],e=Nr(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Nr(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Nr(i),length:o}}function FM(i){return i.axis===yn||i.axis===Jn}function UM(i){return i.axis===ue&&i.source.ax===i.target.ax||i.axis===re&&i.source.ay===i.target.ay}function YR(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function YM(i,r,e){if(FM(i)||UM(i))YR(i,r,e);else{let t=i.axis===re?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===ue?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===re?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===ue?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===ue?re:ue,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function zR(i,r,e){if(e===re)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===ue)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===yn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===Jn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function eT(i,r,e,t,n,o){let s=i,a=[];n=n||$();let l=QS(s);if(l.isFirstSegment)t===qr?YR(l,a,n):YM(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,m=QS(l.target);for(;!p&&m!=null;){let g=zR(d,u,l.axis),E;E=zR(m.isFirstSegment?m.target.ax:m.target.cx,m.isFirstSegment?m.target.ay:m.target.cy,m.axis);let y=vx(g,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=m),m.isFirstSegment?p=!0:m=QS(m.target)}m!=null&&a.push({ax1:m.target.ax,ay1:m.target.ay,ax2:d,ay2:u,pathId:n,axis:m.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function XR(i,r,e,t,n,o){let s=eT(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},m=u+1,g=!1;for(;!g;){let E=s.segments[m];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:m-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[m-1].ax2,ay2:s.segments[m-1].ay2},finished:E==null};m++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function jR(i,r,e,t,n,o,s,a,l,h,d,u,p,m,g,E,y){E==null?E=new Ps(i,r,s,h,d,u):E.reinitialize();let x=E.ko(i.x,i.y),f=E.ko(r.x,r.y),b=_g(n);b.axis==null&&(b.axis=ub(i,r));let A=_g(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:Cg,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let R=T,v=S,_=()=>a===qr?XR(v,R,E,a,g,y):eT(v,R,E,a,y,!0),P=new Hc,I=new Es(P.sort.bind(P),T),C,O,w=xc(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,O=Nr(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return _();P.node=C;let N=UR(E,C,C.x,C.y,s,u,m,S);for(let M=0,D=N.length;M<D;M++){let V=N[M];if(V.isTarget)return V.obj.parent=C,_();if(V.obj.closed||V.obj===T||V.obj===S||V.obstacles.length>0||V.buffers.length>0)continue;let J=0;V.axis!==O&&(J=.5),(!V.obj.opened||V.g<V.obj.g)&&(V.obj.g=V.g,V.obj.h=l(V.cx,V.cy,S.x,S.y)+J,V.obj.f=V.obj.g+V.obj.h,V.obj.parent=C,V.obj.ax=V.ax,V.obj.ay=V.ay,V.obj.opened?I.update(V.obj):(I.add(V.obj),V.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:Cg,isEmpty:!0}}function tT(i,r,e,t,n,o,s,a,l,h,d,u,p,m){return jR(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(g,E,y,x)=>{if(l===qr||l==null)return Pg(g,E,y,x);if(l===Lc)return Pg(g,E,y,x);if(l===Qr)return cb(g,E,y,x)},(g,E)=>{let y=a*d;return s.hasLineOfSight(E,y,g.sourceAndTargetObstacles)},p,m)}var zM=10;function XM(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=Nx([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var Yl=class{constructor(r,e){this.instance=r;c(this,"Zd");c(this,"$anchorLists",new Map);c(this,"Jd");c(this,"wi");c(this,"Di");c(this,"Ni");c(this,"ls",new Map);c(this,"Kd",null);c(this,"pt");e=e||{},this.wi=e.gridCellSize||zM,this.Jd=e.avoidVertices===!0,this.Di=e.vertexBuffer||2,this.Ni=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=Nt(t),a=kn(t),l=Nt(n),h=kn(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(H(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=De(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(H(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=De(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.qd(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),m=this.qd(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});QA(r.connector);let g={sourcePos:p,targetPos:m,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=gE(o,g),pE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!xE(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!xE(m,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&Bi(r),o.edited){let x=this.FE(r,o,g,e,E,y);Ge.setGeometry(r,x,!1)}else{let x=this.UE(r,o,g,e);Ge.setGeometry(r,x,!0)}mE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.zE(r,e)}$connectionRemoved(r){Uo(r.connection.anchors.source)&&this.Qd(r.connection.sourceId,r.connection.anchors.source),Uo(r.connection.anchors.target)&&this.Qd(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.mt){e=e||$();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=Uo(a.anchors.source),u=Uo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),m=(a.anchors.target.faces||[]).join("-"),g=[l,p,h,m].join("-"),E=o[g];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.hs(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Se,t),this.hs(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Se,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.YE(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,g),o[g]=E),d&&this.hs(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.hs(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.XE(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.ls.clear()}zE(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;Dt(o.top,s),Dt(o.left,s),Dt(o.bottom,s),Dt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}jE(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=vu(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=qS(r);if(r.locations.length===1||s==null||a==null)t=vu(h,n,o,e);else{let[d,u]=this.HE(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=vu(u,n,o,e)}}return r.computedPosition=t,t}XE(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(JS[o]),p=o===ft||o===Se,m=KS(t,u,l,h,p);for(let g=0;g<m.length;g++)m[g].a.locations[0]={x:m[g].xLoc,y:m[g].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},m[g].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Se,t,e.top,!0,0,{x:0,y:-1}),n(je,t,e.left,!1,0,{x:-1,y:0}),n(ft,t,e.right,!1,1,{x:1,y:0})}hs(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,m=-1,g={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=g;else{let f=l?m!==-1?m:0:E.length;E.splice(f,0,g)}e.currentFace=h}Qd(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;Dt(o.top,a),Dt(o.left,a),Dt(o.bottom,a),Dt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}qd(r,e){let t=this.jE(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}UE(r,e,t,n){return this.Jd||r.avoidVertices?this.kE(r,e,t,n):this.cs(r,e,t)}FE(r,e,t,n,o,s){return Ge.update(r,e.paintInfo,t,o,s)}cs(r,e,t){return Ge.compute(r,e.paintInfo,t)}kE(r,e,t,n){if(e.edited)this.cs(r,e,t);else{let o=e,s=rT(t.sourcePos,e.sourceGap),a=rT(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),m=Math.max(l.y,h.y),g={x:d,y:p,width:Math.max(u-d,10),height:Math.max(m-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(g,0,[],!1))return this.cs(r,e,t);(this.pt==null||n!==this.Zd)&&(this.pt=new Ps(l,h,this.wi,this.Ni,this.Di,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.Zd=n;try{let E=r.edge?r.edge.id:r.id,y=tT(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.wi,o.constrain,xc,this.Ni,this.Di,this.pt,E);if(y.isEmpty)Ge.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:Cs(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:Cs(a.ox,a.oy),pathId:E});let x=TE(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||jM(b)},b)));return ru(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.cs(r,e,t)}}}YE(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.Kd){let v=this.ls.get(p);if(v!=null)return v}else this.ls.clear();this.Kd=u;let m={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:m.IDENTITY,a:[Se,Se]};let g=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,_)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[je]:{x:_[P][0].x,y:_[P][0].c.y},[ft]:{x:_[P][0].x+_[P][0].width,y:_[P][0].c.y},[Se]:{x:_[P][0].c.x,y:_[P][0].y},[ht]:{x:_[P][0].c.x,y:_[P][0].y+_[P][0].height}},_[P][1]!=null&&_[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=Ix(x[v[P]][I],_[P][1])})([it,xn],[[t,a],[n,l]]);let f=[Se,je,ft,ht];for(let v=0;v<f.length;v++)for(let _=0;_<f.length;_++)y.push({source:f[v],target:f[_],dist:Math.round(Fe(x.source[f[v]],x.target[f[_]]))});y.sort(function(v,_){if(v.dist<_.dist)return-1;if(_.dist<v.dist)return 1;{let P={[je]:0,[Se]:1,[ft]:2,[ht]:3},I=P[v.source],C=P[_.source],O=P[v.target],w=P[_.target];return I<C?-1:C<I?1:O<w?-1:w<O?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let _=y[v];if(!Uo(o)||BE(o,_.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=hE[P],O=this.wi*(this.Ni+this.Di),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(O*C.x)),height:Math.max(1,Math.abs(O*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Uo(s)||BE(s,_.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=hE[P],O=this.wi*(this.Ni+this.Di),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(O*C.x)),height:Math.max(1,Math.abs(O*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let R={a:[b,A],theta:g,theta2:E};return this.ls.set(p,R),R}HE(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,m)=>{let g=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:g,y:E,idx:m}}),d=l.locations.map((p,m)=>{let g=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:m,x:g,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let m=0;m<d.length;m++){let g=Math.round(Fe(h[p],d[m]));u.push({d:g,idx:p,idx2:m})}return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,m)=>({d:XM(p,h,d,r,e,o,s),idx:m}));return u.sort((p,m)=>p.d-m.d),[u[0].idx,a[u[0].idx]]}}};c(Yl,"type",xe);function jM(i){return i.axis!=null?i.axis:i.ax1===i.ax2?ue:i.ay1===i.ay2?re:null}function rT(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var nT="fill",jE="stroke",iT="stroke-width",HM="strokeWidth",Pe="svg",oT="defs",ee="path",He="circle",sT="ellipse",Qe="text",HE="tspan",Z="rect",q="g",kM="version",WM="xmlns",ZM="fill",kE="stroke-dasharray",JM="stroke-linejoin",KM="stroke-linecap",qM="stroke-miterlimit",QM="stroke-dashoffset",eV="stroke-opacity",tV="stroke",rV="stroke-width",Cu="vector-effect",Pu="non-scaling-stroke",nV="text-anchor",Vt="http://www.w3.org/2000/svg",iV="http://www.w3.org/1999/xlink",oV="http://www.w3.org/1999/xhtml";var _u=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Ve,Oe],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var HR=.5;function aT(i,r){var b,A;let e=ZS(i,XE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=ai(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[Su]={type:mr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||HR,id:Su,cssClass:jS,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=ai(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=ai(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=At(l,d),m=At(h,u),g=i.$_edgesDetachable;r.detachable===!1&&(g=!1);let E=i.$_reattachEdges===!0,y=Ns({},r.paintStyle||i.defaults.paintStyle);Le.appendToDefaultType(e,{detachable:g,reattach:E,paintStyle:y,hoverPaintStyle:Ns({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:m},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:g,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[it]:[],[xn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});qt.Wd(x,r.connector||i.$defaultConnector,!0);let f=[xe,r.type].join(" ");return/[^\s]/.test(f)&&Le.addType(x,f,r.data),x}var zl=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Ou=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var kR={},nn={get:i=>{let r=kR[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{kR[i]=r}};function We(i){return function(r){nn.register(i,r)}}function Ru(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let m=(isFinite(i.xmax)?i.xmax:0)+u+l,g=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||m,m),y=Math.min((a==null?void 0:a.height)||g,g);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function lT(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=At(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===it?n.anchors.source=l:n.anchors.target=l,qt.setVisible(n,o.originallyVisible),s}return null}function hT(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(Y(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=At(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=At(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=CA(o.proxies[e]),l=a!=null?a.originalElement.id:e===it?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===it?o.anchors.source:o.anchors.target;e===it?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),qt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var sV=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function WE(i,r,e){r!=null&&(jm(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Ml)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(jm(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Ml))}function ZE(i,r,e){if(r!=null){let t=r.connections.length;Dt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Ml)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&Dt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Ml)}}var aV=2,lV=2,Lu=class extends Gt{constructor(e,t,n,o,s){var l,h,d,u,p,m,g,E,y,x,f,b,A,T;super();c(this,"Za",[]);c(this,"Ja",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Ii",{});c(this,"hoverSuspended",!1);c(this,"mt",!1);c(this,"eu",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"connectorClass",Zs);c(this,"connectorOutlineClass",PS);c(this,"connectorPathClass",CS);c(this,"overlayClass",Js);c(this,"labelOverlayClass",OS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"ds");c(this,"viewport",new xu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"Ka",new Map);c(this,"Ee");c(this,"qa",new Set);c(this,"tu");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"ru");c(this,"nu");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"J",1);c(this,"$collapsedGroupSizeCalculator");c(this,"iu");c(this,"Qa");c(this,"nl");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"ou");c(this,"$relayoutOnResize");c(this,"us");c(this,"rootElement");c(this,"Mt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||$(),this.gridProfile=new zl(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||_n,this.ru=(h=o.edges)==null?void 0:h.sourceMarker,this.nu=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>ai(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((m=o.edges)==null?void 0:m.anchors)||[null,null],this.ou=o.refreshLayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.defaults={[mu]:null,[VS]:1,[$o]:{strokeWidth:2,stroke:"#000000"},[DE]:"vjs_defaultscope",[wE]:!0,[IS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Ii,this.defaults),this.Ii[$o]!=null&&(this.Ii[$o].strokeWidth=this.Ii[$o].strokeWidth||2),this.tu=this.defaults[DE],this.allowNestedGroups=this.Ii[wE]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[DS]:aV,this.$_vertexBorder=o.edges?o.edges[wS]:lV,this.ds=((g=o.edges)==null?void 0:g.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new Yl(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.ds}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Ou(o.magnetizer||{}),this.magnetizer=new Oi({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,R)=>{}}),this.us=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.us=!1),this.setContainer(n),this.$setView(o.view),this.il(yt,S=>{let R=this.$_connMap[S.edge.getId()];if(R){let v=this.dataSource.getEdgeType(S.edge.data),_=[...new Set([xe,v])];if(this.$_setConnectionType(R,_.join(" "),S.edge.data),this.us===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(R,P,!0)}this.ie(P=>{P.$edgeUpdated(S.edge,R)})}}),this.il(ed,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.ie(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.il(Qc,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var R=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(R),this.ie(v=>{v.$groupResized({element:R,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=nt.get(bs.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:mo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.iu=o.defaultCollapsedGroupSize||{width:200,height:150},this.Qa=o.canCollapseGroup,this.nl=o.canExpandGroup}get defaultScope(){return this.tu}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.J}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.target)&&(s=this.su(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this.WE(n,s,!Ci(e.old))):(delete this.$_connMap[t.getId()],this.ol(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Xi)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Gl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Xi)}}setSuspendRendering(e,t){}$deselect(e){if(K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Xi)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Gl)}else if(H(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Xi)}}$selectionCleared(e){this.$getSelector(this.Ee,z(Gl)).forEach(t=>this.$removeClassFromElement(t,Gl)),this.$getSelector(this.Ee,z(Xi)).forEach(t=>this.$removeClassFromElement(t,Xi))}su(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&H(t.source)&&(s=this.su(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.ZE(n,s,!Ci(e.old)):(delete this.$_connMap[t.getId()],this.ol(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind(Di,e)}il(e,t){this.Za.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(fd)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=$();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(An)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=Y(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.ps(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}au(){let e,t,n,o,s,a=!1,l=$();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.lu(h[e],sl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.Mt.length!==0}JE(e,t,n,o){let s=H(o.source)?o.source.getParent():o.source,a=H(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(H(o.source)?null:this.$getAttribute(e,Ui)||this.$getAttribute(e,Xr)),h=n.targetPortType||(H(o.target)?null:this.$getAttribute(e,Yi)||this.$getAttribute(t,Xr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return sV.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}KE(e,t,n,o){var R,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=H(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=H(s.target)?s.target.getParent():s.target,m=this.getElement(p.id),{sourceDef:g,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.JE(u.el,m.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.ru,targetMarker:h.targetMarker||this.nu};[pu,NS,MS].forEach(_=>{h.hasOwnProperty(_)&&(f[_]=h[_])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(_,P,I,C,O)=>{if(C&&C[I]){let w=_[P]||[C[I],C[I]];w[O]=C[I],_[P]=w}};g!=null&&A(f,Bl,$l,g,0),E!=null&&A(f,Bl,$l,E,1);let T=f;if(T.avoidVertices=this.ds||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,uo(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(R=s.anchors)!=null&&R.source)f.anchors[0]=At(s.anchors.source);else{let _=a.positionOnSource||{x:0,y:0},P=g.anchorPositions||y.anchorPositions,I=g.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=bu(P.slice(),null,_);else if(I!=null){let C=I(u.el,_,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=At(s.anchors.target);else{let _=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=bu([a.targetAnchor]);else if(P!=null)f.anchors[1]=bu(P.slice(),null,_);else if(I!=null){let C=I(m.el,_,s.target,E);f.anchors[1]=C}}this.us===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=aT(this,f);if(S!=null){WE(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(Ge.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.ou&&this.refresh(),(m.visible===!1||u.visible===!1)&&this.ms(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let _={connection:S,edge:s,reason:e.reason};this.ie(P=>P.$edgeRendered(_)),this.fire(wb,_)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.ii(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.ie(o=>{o.$groupRemoved(t)})),t}lu(e,t,n,o,s,a){this.Mt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.Mt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.Mt.length;s++)this.qE(this.Mt[s],e)==null?o.push(this.Mt[s]):n.push(this.Mt[s].edge);this.Mt=o}return n}qE(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.KE(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.lu(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.ol(n,{fireEvent:!1,force:!0}),this.ie(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?Ge.importGeometry(o,t):Bi(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(qn,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:Ur(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges($()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.ie(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.hu(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===$s&&this.ds){let d=this.model.getAllEdges().filter(u=>Wn(u.source).id!==e.vertex.id&&Wn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===Rd?this.QE(this.getElement(t.id),e.originalData):this.fire(Ms,this.getElement(t.id)),this.ie(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}QE(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=Y(e.modelObject)?Vr:Mt;this.fire(s,o)}ef(e){this.fire(Re,e)}getLayoutFor(e){return tg(e)||rg(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,nA),this.ie(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.ie(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.ie(o=>{o.$nodeRemoved(t)}),this.ef(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,Il),this.$removeAttribute(n.el,Xr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&qt.Wd(o,s.connector),Le.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=K(e),a=Y(e);this.$setAttribute(t,te,e.getFullId());let l=s?zi:a?Go:H(e)?RS:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,mt,this.$getAttribute(h.el,mt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Xi)),K(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let g=this.cu(e.group);this.$appendElement(t,g)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let m=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.hu(e,p,!this.$_dataLoading,!1),K(e)){if(!d){let g={el:t,id:e.id,vertex:e,size:u};this.fire($r,g)}}else if(Y(e)){let g={el:t,vertex:e,id:e.id,size:u},E=m,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:mo.type};this.layoutMap.set(e.id,this.du(x,e)),this.fire(Gr,g),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.ie(g=>{g.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=$();this.uu(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t){let n=e.connections||[];return this.uu(n,t),n}uu(e,t){this.router.$redrawConnections(e,t),e.forEach(n=>{this.$paintConnection(n,{timestamp:t})})}ms(e,t,n){let o=this.$_connMap[e.id];o&&qt.setVisible(o,t)}isVisible(e){return this.pu(e,t=>{switch(t.type){case Ue.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case le.objectType:case ie.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Ue.objectType:this.ms(s.obj,t,n);break;case le.objectType:case ie.objectType:this.tf(s,t,n);break;case ce.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.pu(e,o)}tf(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.dA=t,e.managedElement.visible=t,this.fire(yd,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.ms(o[s],t,n);else{let a=Wn(o[s].source),l=Wn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ms(o[s],t,n)}}}pu(e,t){let n;if(EA(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=K(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.Ee}setZoom(e,t){return this.J=e,e}k(e){if(e==null)return null;let t=this.$getAttribute(e,mt);return(!t||t==="undefined")&&(t=`vjs-${$()}`,this.$setAttribute(e,mt,t)),t}setContainer(e){this.Ee=e}mu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}ZE(e,t,n){ZE(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.mu(e,t,0,n);WE(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}WE(e,t,n){ZE(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.mu(e,t,1,n);WE(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=Le.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.mt;return this.mt=e,e?this.eu=""+new Date().getTime():this.eu=null,this.mt||(this.autoSizeGroups(Array.from(this.qa.keys()).map(o=>o.modelObject)),this.qa.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.mt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}rf(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}ol(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.rf(e)===!0)?(ZE(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:ol,edge:e.edge}),delete this.$_connMap[e.id],qt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,mt)==null&&this.$setAttribute(e,mt,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.mt||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.k(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,mt),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},Vs,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},mA,!1)},ut)}hu(e,t,n,o){let s=X(e)?e:e.id;if(this.getElement(s)){this.viewport.BE(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.ie(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((K(s.modelObject)||Y(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(H(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.k(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):yu()}repaintEverything(e){let t=$();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=yu(),a=l=>{l.forEach(h=>s.add(h))};if(!this.mt){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.k(h))).filter(h=>h!=null&&h.id!==e.id);if(t==null&&(t=$()),!n)for(let h=0;h<l.length;h++)this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t))}o&&this.fire(md,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.Mt.length=0,this.$unrenderedVertices.clear(),this.qa.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(K)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.Ja.length;e++)this.off(this.Ee,this.Ja[e][0],this.Ja[e][1]);this.reset(),this.unbind(),this.Ka.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.Ka.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=ai(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=ai(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=ai(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.Ka.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===it?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===xn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),ZE(n,h,d),WE(n,a,l))}sl(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=En(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.al(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,m=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||m<0)){let g=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let g=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:g.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.nl?this.nl(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.gu(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[LE],[RE]);let l=new Set,h=new Set,d=new Set;this.Eu(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let m in p)this.model.updateVertex(m,p[m])}this.sl(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.ie(p=>{p.$groupExpanded(n)}),this.fire(Ed,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){hT(this,e,t,n,o)}$_unproxyEdge(e,t,n){return lT(this,e,t,n)}Eu(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=ig(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=el(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?xn:it})}),h.right.forEach(d=>{o.add(d)}),this.fu(e).forEach(d=>{this.Eu(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(X(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}gu(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.Qa==null?null:this.Qa(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.gu(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[RE],[LE]);let h=new Set,d=new Set;this.yu(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let m in p)this.model.updateVertex(m,p[m])}this.sl(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.ie(p=>{p.$groupCollapsed(n)}),this.fire(gd,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.iu}fu(e){return e.modelObject.members.filter(t=>t.objectType===ie.objectType).map(t=>this.viewport.getGroupElement(t.id))}yu(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=ig(e.modelObject,!0,!0);if(e.proxied!==!1){let a=el(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?xn:it})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.fu(e).forEach(a=>{this.yu(a,t,n)})}nf(){return this.xu(this.dataSource.getGroups().filter(this.objectFilter))}xu(e){let t=[];return e.forEach(n=>{let o=En(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=Y(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(fl,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===rA&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=yu();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.of(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.bu(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},Sn,t)}refresh(e){this.bu(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Is,e)}bu(e,t,n,o){if(!this.mt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let g in l)p.push(this.dataSource.getVertex(g));this.magnetizer.setElements(p);let m=this.magnetizer.executeAtCenter({getPosition:g=>l[g.id],getSize:g=>a.sizes[g.id]});for(let g in m.current)l[g]=m.current[g]}let h=this.sf(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(g,E)=>h.info[g].positions[E]||this.getElementPosition(E),m=(g,E)=>a.sizes[E]||h.info[g].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(g=>{let E=vi();g.group.members.forEach(x=>{let f=p(g.group.id,x.id),b=m(g.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.al(g.group,l,a.sizes,E,!1);if(y!=null&&(s[g.group.id]={group:g.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[g.group.id]!=null&&(l[g.group.id]=y.position),u[g.group.id]=this.$_getGroupContentAreaInfo(g.group.id),a.sizes[g.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[g.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let m=p.group.id,g=h.info[m],E=l[m]||Nt(g.element),y=u[m]||this.$_getGroupContentAreaInfo(m);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:g.positions,sizes:g.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(fl,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=$();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.mt&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,qt.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}}e.lastPaintedAt=n,t.fireEvent&&this.fire(bb,e)}}$addOverlay(e,t,n){let o=Ul(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){Fo(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),Tu(e),n&&this.$paintConnection(e)}$setView(e){this.view=new fu(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height},o=(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(a=>{let l=K(a.modelObject),h=l&&tg(a.modelObject),d=Y(a.modelObject),u=d&&rg(a.modelObject),p=e.dontIncludeNodes===!0&&l,m=e.dontIncludeGroups===!0&&d,g=e.dontIncludeNodesInsideGroups&&h,E=e.dontIncludeNestedGroups&&u;return!(p||m||g||E)}),s=e.filter||(()=>!0);return o.filter(a=>s(a.modelObject)).map(a=>({enclosed:e.enclosed,id:a.id,r:a,v:a.modelObject,el:a.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}cu(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(Qs(e)){let n=e.edge;return{obj:n,id:n.id,type:Ue.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.k(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===Ue.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}ll(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}af(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let g=this.getObjectInfo(e,!1);if(g.obj)if(!l)p.focus=g.obj.id;else{let E=this.getElement(g.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===g.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let m=this.getGrid();return m&&(p.grid=m),p}gs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.ll());let p=this.af(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}ps(e,t,n,o,s,a,l,h,d){let u=this.gs(e,t,n,o,s,null,a,l,h,d);this.Es(u,uA)}magnetize(e,t){this.ps(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.gs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.gs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.ps(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.ps(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.ll(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}Au(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}lf(e,t){let n=this.Au(t);this.model.updateVertex(e,n)}Es(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.Au(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),Ce(l.data,s,n.x),Ce(l.data,a,n.y)),n}of(e,t){let n=X(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),Ce(n.data,this.$modelWidthAttribute,t.width),Ce(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.hf(a.obj,t,n,o,s===!1,!1,!1,!1);this.Es(l,Rd)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.Es({original:{},current:u},Rd,()=>{this.sl(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.du(t,n.obj)),this.relayoutGroup(n.obj,tA),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}hf(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.gs(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.df()&&(d=ae(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);Ce(l.data,n,h.x),Ce(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new zl({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}df(){return this.gridProfile!=null&&this.gridProfile.snap}uA(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=ae({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.ll());let o=this.magnetizer.snapToGrid(t);return this.Es(o,pA),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.xu(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.uf(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}uf(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.al(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}sf(){let e={orderedGroups:this.nf(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(qc,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.ie(l=>{l.$groupResized(n)}),this.model.fire(Oe,{vertex:o,updates:s,originalData:o.data,reason:dA},null)}}}al(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),m=this.$_getGroupContentAreaInfo(e.id),g=m.contentArea,E=0,y=0,x,f,b=p(e.id),A=m.isGroupElement?p(e.id):this.$getSize(g),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),R=Object.assign({},u(e.id)),v,_=null;if(_!=null)E=_.layoutShiftX,y=_.layoutShiftY,x=_.width,f=_.height,v={x:R.x-E,y:R.y-y};else{let P=Ru(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:R.x-E,y:R.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(g,x,f),!m.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,O=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),O<0&&(this.$setElementHeight(g,S-m.internalOffset.y),O=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(g,T-m.internalOffset.x),C=0,w=!0),O>0&&(this.$setElementHeight(g,S-m.internalOffset.y),O=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}Su(e){let t={container:this.Ee,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:Ce(n.data,this.$modelLeftAttribute),y:Ce(n.data,this.$modelTopAttribute)})),nt.get(e.type,t)}du(e,t){let n=this.cu(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:Ce(s.data,this.$modelLeftAttribute),y:Ce(s.data,this.$modelTopAttribute)};return X(a.x)&&(a.x=parseInt(a.x,10)),X(a.y)&&(a.y=parseInt(a.y,10)),a}),nt.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.Su(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.Su(e).layout(n=>{for(let o in n.positions)this.lf(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[zi,LS].join(" "),{[te]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}Tu(e){(e.plugins||[]).forEach(n=>{this.vu(n,!0)})}addPlugin(e){return this.vu(e,!0)}vu(e,t){let n=X(e)?e:e.type,o=X(e)?{}:e.options||{},s=nn.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),t&&this.fire(xd,s),s}getPlugin(e){return this.pluginMap.get(e)}ie(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.J};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!X(e)&&Array.isArray(e)}};var hV=20,cV=20,JE=class JE extends Rn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",JE.type);c(this,"contentTags",[ee]);n=n||{},this.width=n.width||hV,this.length=n.length||cV,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let g=this.location<0?1:0;o=$e(e,g,this.location,!1),s=$e(e,g,this.location-this.direction*this.length/2,!1),a=Xt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=$e(e,this.location,-this.length),a=Xt(o,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=$e(e,this.location,this.length),o=Xt(a,s,this.length),this.direction===-1){let g=a;a=o,o=g}}else o=$e(e,this.location,this.direction*this.length/2),s=ur(e,this.location),a=Xt(o,s,this.length);l=wt(o,a,this.width),h=Xt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(JE,"type","Arrow");var _r=JE;at.register(_r.type,_r);var KE=class KE extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",KE.type);this.foldback=1}};c(KE,"type","PlainArrow");var wu=KE;at.register(wu.type,wu);var qE=class qE extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",qE.type);this.length=this.length/2,this.foldback=2}};c(qE,"type","Diamond");var Du=qE;at.register(Du.type,Du);var QE="Custom",ef=class extends si{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",QE);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function on(i){return i.type===QE}at.register(QE,ef);var WR=5,tf=class tf extends Rn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Pe");c(this,"jr");c(this,"type",tf.type);c(this,"contentTags",[He]);n=n||{},this.Pe=n.radius||WR,this.jr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.jr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=$e(e,this.location,this.Pe);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=$e(e,this.location,this.Pe);l=Xt(d,u,this.Pe),h=$e(e,this.location,2*this.Pe)}else if(this.location===1)if(this.jr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=$e(e,this.location,-this.Pe);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=$e(e,this.location,-this.Pe);l=Xt(d,u,this.Pe),h=$e(e,this.location,-2*this.Pe)}else l=ur(e,this.location),h=$e(e,this.location,this.Pe);return{atts:[{cx:l.x,cy:l.y,r:this.Pe,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Pe,xmax:l.x+this.Pe,ymin:l.y-this.Pe,ymax:l.y+this.Pe,tail:h}}};c(tf,"type","Dot");var Nu=tf;at.register(Nu.type,Nu);var ZR=10,JR=10,rf=class rf extends Rn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"Cu");c(this,"jr");c(this,"type",rf.type);c(this,"contentTags",[ee]);n=n||{},this.width=n.width||ZR,this.height=n.height||JR,this.Cu=n.rotate===!0,this.jr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;if(this.Cu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},_,P;this.jr==="center"?(P=$e(e,this.location,this.width/2),_=Xt(P,v,this.width)):(_=v,P=$e(e,this.location,this.width)),S=wt(P,_,this.height),R=wt(_,P,this.height),m=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},_,P;this.jr==="center"?(P=$e(e,this.location,-this.width/2),_=Xt(P,v,this.width)):(_=v,P=$e(e,this.location,-this.width)),S=wt(_,P,this.height),R=wt(P,_,this.height),m=P}else{let v=$e(e,this.location,this.width/2),_=ur(e,this.location),P=Xt(v,_,this.width);S=wt(v,P,this.height),R=wt(P,v,this.height),m=P}g=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=R[1].x,b=R[1].y,A=R[0].x,T=R[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=ur(e,this.location),m=v,g=v.x-this.width/2,E=v.y-this.height/2,y=g+this.width,x=E,f=y,b=E+this.height,A=g,T=E+this.height}return h=Math.min(g,y,f,A),d=Math.max(g,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${g} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:m}}};c(rf,"type","Rectangle");var Iu=rf;at.register(Iu.type,Iu);var KR=8,qR=5,nf=class nf extends Rn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",nf.type);c(this,"contentTags",[sT]);n=n||{},this.rx=n.rx||KR,this.ry=n.ry||qR}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=ur(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:$e(e,this.location,(this.ry+this.rx)/2)}}};c(nf,"type","Ellipse");var Mu=nf;at.register(Mu.type,Mu);var Vu=class{constructor(r,e){this.surface=r;c(this,"nr");c(this,"Pu");e=e||{edgeMappings:[]},this.nr=e.edgeMappings||[],this.Pu=this.surface.model.edgeTypeFunction,this.pf()}computeTypes(r){let e=[this.Pu(r)];for(let t=0;t<this.nr.length;t++){let n=this.nr[t].property,o=this.nr[t].mappings;if(X(n)){if(r[n]!=null){let s=X(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[pr]!=null&&r[n]!=null&&e.push(`${n}_${pr}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}pf(){for(let r=0;r<this.nr.length;r++){let e=this.nr[r].property,t=this.nr[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=X(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.nr}};function dV(i,r,e,t,n,o,s){return new Touch({target:i,identifier:$(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function uV(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function pV(i,r,e,t,n,o,s){return uV(dV(i,r,e,t,n,o,s))}function Xl(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function Gu(i){return i.srcElement||i.target}function cT(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function mV(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var gV=1,QR=!1,e0=!1;function Ln(){return QR||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function li(){return e0||"onmousedown"in document.documentElement}function i0(i){QR=i}function o0(i){e0=i}var Hi={[pe]:Gb,[se]:$b,[oe]:Bb};function dT(i,r){if(i==null)return{x:0,y:0};let e=Yo(i),t=lf(e,0);return r(t)}function me(i){return dT(i,r=>({x:r.pageX,y:r.pageY}))}function EV(i){return dT(i,r=>({x:r.screenX,y:r.screenY}))}function fV(i){return dT(i,r=>({x:r.clientX,y:r.clientY}))}function lf(i,r){return i.item?i.item(r):i[r]}function Yo(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function gT(i){return Yo(i).length}function s0(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Yo(i),e=lf(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function of(i,r,e,t,n){r0(i,r,e),t.ir=e.ir,i.addEventListener&&i.addEventListener(r,e,!1,n)}function $u(i,r,e){e!=null&&t0(i,t=>{yV(t,r,e),e.ir!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),Ln()&&Hi[r]&&t.removeEventListener(Hi[r],e,!1)),e.Ou&&$u(i,e.Ou[1],e.Ou[0])})}function t0(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function r0(i,r,e){let t=gV++;return i.Hr=i.Hr||{},i.Hr[r]=i.Hr[r]||{},i.Hr[r][t]=e,e.ir=t,t}function yV(i,r,e){if(i.Hr&&i.Hr[r]&&delete i.Hr[r][e.ir],e.kr){for(let t=0;t<e.kr.length;t++)$u(i,e.kr[t][0],e.kr[t][1]);e.kr.length=0}e.hl&&e.hl()}var xV=/:not\(([^)]+)\)/;function sf(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(xV);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(pr);let a=l=>{a.ir=e.ir;let h=Gu(l),d=!1,u=h,p=cT(l,h,r,i!=null);if(p.end!=-1)for(let m=0;!d&&m<p.end;m++){u=p.path[m];for(let g=0;g<s.length;g++)if(Xl(u,s[g],r))return;for(let g=0;!d&&g<o.length;g++)if(Xl(u,o[g],r)){e.apply(u,[l,u]),d=!0;break}}};return bV(e,t,a),a}}function bV(i,r,e){i.kr=i.kr||[],i.kr.push([r,e])}var af=(i,r,e,t,n)=>{if(Ln()&&Hi[r]){let o=sf(t,i,e,Hi[r]);of(i,Hi[r],o,e,n)}r===Mb&&i.getAttribute(PE)==null&&i.setAttribute(PE,"1"),of(i,r,sf(t,i,e,r),e,n)},uT={[W]:{touches:1,taps:1},[Br]:{touches:1,taps:2},[bt]:{touches:2,taps:1}};function n0(i,r,e,t){for(let n in e.Ve[i])e.Ve[i].hasOwnProperty(n)&&e.Ve[i][n].apply(t,[r])}var pT=class{static generate(r,e){return(t,n,o,s)=>{if(n==bt&&li())af(t,n,o,s);else{if(t.He==null){let a=t.He={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let m=Gu(p),g=cT(p,m,t,s!=null),E=!1;for(let y=0;y<g.end;y++){if(E)return;m=g.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||Xl(m,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let m=Gu(p),g,E;a.taps++;let y=gT(p);for(let x in uT)if(uT.hasOwnProperty(x)){let f=uT[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=cT(p,m,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(g=E.path[A],a[x][b][1]==null||Xl(g,a[x][b][1],t)){a[x][b][0].apply(g,[p,g]);break}}}}};t.He.downHandler=d,t.He.upHandler=u,af(t,pe,d),af(t,se,u)}t.He.downSelectors.push(s),t.He[n].push([o,s]),o.hl=function(){t.He!=null&&(Dt(t.He.downSelectors,a=>a===s),mV(t.He[n],o),t.He.downSelectors.length===0&&($u(t,pe,t.He.downHandler),$u(t,se,t.He.upHandler),delete t.He))}}}}},mT=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Ve){e.Ve={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Gu(l);(o==null&&h==e&&!e.Ve.over||Xl(h,o,e)&&(h.Ve==null||!h.Ve.over))&&(n0(Gg,l,e,h),h.Ve=h.Ve||{},h.Ve.over=!0,r.push(h))},a=l=>{let h=Gu(l);for(let d=0;d<r.length;d++)h==r[d]&&!Xl(l.relatedTarget||l.toElement,"*",h)&&(h.Ve.over=!1,r.splice(d,1),n0($g,l,e,h))};of(e,st,sf(o,e,s,st),s),of(e,ot,sf(o,e,a,ot),a)}n.hl=function(){delete e.Ve[t][n.ir]},r0(e,t,n),e.Ve[t][n.ir]=n}}},fe=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=mT.generate(),this.tapHandler=pT.generate(this.clickThreshold,this.dblClickThreshold)}mf(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Br||e===bt?this.tapHandler(s,e,t,n,o):e===Gg||e==$g?this.mouseEnterExitHandler(s,e,t,n,o):af(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.mf(r,e,a,s,o),this}off(r,e,t){return $u(r,e,t),this}trigger(r,e,t,n,o){let s=li()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=Ln()&&!li()&&Hi[e]?Hi[e]:e,l=!(Ln()&&!li()&&Hi[e]),h=me(t),d=EV(t),u=fV(t);return t0(r,p=>{let m;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let g=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=pV(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&Ln()&&Hi[e],x=y?"TouchEvent":"MouseEvents";m=document.createEvent(x),E[x](m),g(m),p.dispatchEvent(m)}),this}};var AV=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function de(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function G(i,r,e,t){return r=r||{},ta(Vt,i,e,t,r)}function a0(i,r){let e=r.map(t=>G("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function SV(i,r){i.gradient==null&&(i.gradient=G("linearGradient",{id:Qa(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),a0(i.gradient,r)}function ET(i,r,e){let t=Qa(),n=G("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return a0(n,e),{id:t,g:n}}function hf(i,r,e,t){r.setAttribute(nT,e.fill?e.fill:pt),!t&&e.gradient?(SV(i,e.gradient),r.setAttribute(jE,`url(#${i.gradient.id})`)):r.setAttribute(jE,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(iT,e.strokeWidth),e.dashArray?r.setAttribute(kE,e.dashArray):r.removeAttribute(kE),AV.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function ea(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function TV(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...vV(o,r,e))}),t}function vV(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=G(HE);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function CV(i,r,e){return TV(i,r,e).map(t=>{let n=G(HE);return n.innerHTML=t,n})}function Bu(i,r,e){let n=i.getAttribute(Q)||"50%",o=CV(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(Q,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var cf="data-vjs-container",df="data-vjs-group-content",Fu="data-vjs-expanded-content",Uu="data-vjs-collapsed-content",gr="data-vjs-enabled",zo="data-vjs-scope",jl="data-vjs-is-group",PV="element",_V="connection",Ze="div",uf="position",kr=z(Zs),fT=be(df),wn=z(Js),yT=z(du);function $t(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function he(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Bt(i,r,e,t){if(i.contains(e))return null;if(t&&$t(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if($t(i,r))return i;i=i.parentNode}}function OV(i,r,e){e=e||document.body;let t=[],n=Bt(i,r,e,!1);for(;n!=null;)t.push(n),n=Bt(n,r,e,!1);return t}function Xo(i){return i.srcElement||i.target}function l0(i,r){r=Tt(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function pf(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function h0(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=pf(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),l0(i,s.join(" "))}function Dn(i){return!X(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function RV(i){return!X(i)&&(Array.isArray(i)||Dn(i))}function bT(i){return!X(i)&&(Array.isArray(i)||Dn(i))}function AT(i){return pf(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Tt(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):h0(t,n))};Dn(i)?i.forEach(t=>e(t,r)):e(i,r)}function sn(i,r){return i.classList?i.classList.contains(r):pf(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?Tt(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):h0(t,null,n))};Dn(i)?i.forEach(t=>e(t,r)):e(i,r)}function mf(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):sn(t,n)?F(t,n):L(t,n))};Dn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Ft(i,r=[],e=[]){let n=pf(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),l0(i,n.join(" "))}function ST(i,r){let e=null;if(arguments.length===1){if(!X(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function Wr(i,r,e,t){return ta(null,i,r,e,t)}function ta(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),de(o,n||{}),o}function Zr(i,r,e,t,n,o,s){let a=ta(i,r||Ze,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function ki(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function Yu(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Rt(i){return Yu(i)==="SVG"}function Wi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var xT=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function ra(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function na(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===Ht?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function zu(i,r,e){let t=r.getBoundingClientRect(),n=me(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function TT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function LV(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function hi(i,r){return"["+i+"='"+r+"']"}function wV(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function DV(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function z(...i){return i.map(r=>"."+r).join(",")}function NV(...i){return i.join(" ")}function be(...i){return i.map(r=>"["+r+"]").join(",")}var Hl=be(mt);function kl(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var c0="deltaY",d0="deltaX",IV="wheelDeltaY",MV="wheelDeltaX",gf="webkit",Wl="mac",Xu="win",vT="ie",CT="safari",PT="firefox",_T="default";function u0(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function p0(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var OT={[gf]:{[Wl]:kl(c0,120),[Xu]:kl(c0,100)},[CT]:kl(IV,120,!0),[PT]:{[Wl]:u0,[Xu]:u0},[vT]:function(i){return i.wheelDelta/120},[_T]:function(i){return i.deltaY||i.wheelDelta}},RT={[gf]:{[Wl]:kl(d0,120),[Xu]:kl(d0,100)},[CT]:kl(MV,120,!0),[PT]:{[Wl]:p0,[Xu]:p0},[vT]:function(i){return i.wheelDelta/120},[_T]:function(i){return i.deltaX||i.wheelDelta}},m0=typeof navigator!="undefined",g0=m0?/Mac/.test(navigator.userAgent)?Wl:Xu:Wl,Zl=m0?navigator.userAgent.indexOf("Firefox")!==-1?PT:/Chrome/.test(navigator.userAgent)?gf:/Safari/.test(navigator.userAgent)?CT:/WebKit/.test(navigator.userAgent)?gf:/Trident/.test(navigator.userAgent)?vT:"default":_T,VV=typeof OT[Zl]=="function"?OT[Zl]:OT[Zl][g0],GV=typeof RT[Zl]=="function"?RT[Zl]:RT[Zl][g0],$V=function(i){return VV(i||event)},BV=function(i){return GV(i||event)},FV=function(i,r,e){let t=n=>{let o=$V(n),s=BV(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.gf=t,t},UV=typeof document!="undefined",E0=UV?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function Jl(i,r,e,t){let n=FV(r,e,t);return i.addEventListener?i.addEventListener(E0,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function Kl(i,r){let e=r.gf;e!=null&&(i.removeEventListener?i.removeEventListener(E0,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function LT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var wT="vjs-paper",DT="vjs-paper-canvas",NT=20,YV="vjs-paper-node",ql="start",jo="center",Ql="end";function IT(i){return jr(i)&&i.useHTMLElement===!0}var eh=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=Wr(Ze,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(qe,t.edge.id),e.contentElement.setAttribute(cu,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=Ke,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,Vl),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function MT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[cu]:r.id},r.attributes);e.forEach(n=>{let o=G(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&ea(n,t,-1)}}),r.contentElements}function VT(i,r,e,t){let n=r;MT(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);de(a,d)})}function th(i,r){return MT(i,r,r.contentTags)}function Ho(i,r){return MT(i,r,[q]),r.bgElement==null&&(r.bgElement=G(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=G(Qe),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function GT(i,r,e,t){Ho(i,r);let n=mn(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),de(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,m={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};de(r.bgElement,m)}function Ef(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var ju=class extends si{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var ci="transform",$T=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,f0=/rotate\(([-0-9\.]+)\)/,zV=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function et(i){let r=i;return r.width&&r.width.baseVal?ZV(r):r.getBBox?JV(r):XV(i)}function ln(i,r){let e=i;return Rt(i.parentElement)?rh(e,r):e.x&&e.x.baseVal?kV(e):jV(e)}function we(i,r){let e=i;Rt(i.parentElement)?an(e,r):(e.x&&e.x.baseVal&&WV(e,r),Qt(e,r))}function Hu(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function y0(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===q){let s=rh(o);s[n]=r,an(o,s)}}function BT(i,r){y0(i,r,je,Q,Q)}function FT(i,r){y0(i,r,Se,Ee,Ee)}function Or(i,r,e){let t=i;t instanceof HTMLElement?x0(i,r,e):t.width&&t.width.baseVal&&(x0(i,r,e),i.setAttribute(ve,`${r}`),i.setAttribute(Ne,`${e}`))}function UT(i,r){let e=i;e instanceof HTMLElement?b0(i,r):e.width&&e.width.baseVal&&(b0(i,r),i.setAttribute(ve,`${r}`))}function YT(i,r){let e=i;e instanceof HTMLElement?A0(i,r):e.height&&e.height.baseVal&&(A0(i,r),i.setAttribute(Ne,`${r}`))}function XV(i){return{width:i.offsetWidth,height:i.offsetHeight}}function jV(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function HV(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function Qt(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function x0(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function b0(i,r){i.style.width=`${r}px`}function A0(i,r){i.style.height=`${r}px`}function kV(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function WV(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function ZV(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function JV(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function rh(i,r){let e,t,n,o,s;if(e=i.getAttribute(ci),e!=null){if(t=e.match($T),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(f0),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=De(h,{x:o,y:s},a),u=De({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match($T);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function di(i,r){if(Rt(i.parentElement)){let t=(i.getAttribute(ci)||"").match($T);i.setAttribute(ci,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(zV),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function an(i,r){let t=(i.getAttribute(ci)||"").match(f0);i.setAttribute(ci,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function S0(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return De(r,t,e)}function zT(i,r){let e=S0(i,r,i.r);an(i.el,e),di(i.el,i.r)}var ku=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[ve]:""+(n[0]||0),[Ne]:""+(n[1]||0)};de(r.canvas,o),we(r.canvas,r)}}}};var ff="vjs-surface",XT="vjs-surface-direct-render",jT="vjs-surface-touch-device",HT="vjs-surface-pointer-device",yf="vjs-surface-nopan",xf="vjs-surface-canvas",bf="vjs-surface-pan",KV="vjs-surface-pan-left",qV="vjs-surface-pan-top",QV="vjs-surface-pan-right",e1="vjs-surface-pan-bottom",Af="vjs-surface-pan-active",Sf="vjs-surface-flash",kT="vjs-flash-vertex",Tf="vjs-surface-panning",vf="vjs-surface-element-dragging",nh="vjs-element-dragging",Cf="vjs-group-child-element-dragging",ih="vjs-most-recently-dragged",Nn="vjs-surface-edge-dragging",Pf="vjs-edge-relocating",Wu="vjs-edge-will-relocate",WT="vjs-lasso",oh="vjs-lasso-mask",ZT="vjs-lasso-mask-left",JT="vjs-lasso-mask-top",KT="vjs-lasso-mask-right",qT="vjs-lasso-mask-bottom",Zu="vjs-miniview",QT="vjs-miniview-canvas",ev="vjs-miniview-panner",tv="vjs-miniview-lasso",rv="vjs-miniview-element",nv="vjs-miniview-group-element",sh="vjs-miniview-selected",_f="vjs-miniview-panning",iv="vjs-miniview-collapse",Ju="vjs-miniview-collapsed",ov="vjs-miniview-click-to-center",gt="vjs-drag-select-defeat",Of="vjs-default-node",Rf="vjs-default-group",Zi="vjs-connector-source-drag",Ji="vjs-connector-target-drag",sv="vjs-connector-transient-drag",ko="vjs-palette-selected-element",ah="vjs-palette-tap-mode-active",av="vjs-palette-drag-active",lv="vjs-palette-drag-hover",hv="vjs-palette-drag-hover-cannot-drop",cv="vjs-palette-current",Ku="vjs-palette-current-shape-type",lh="vjs-drag-hover-cannot-drop",Lf="vjs-drag-original-group",Er="vjs-drag-active",fr="vjs-drag-hover",wf="vjs-source-hover",Df="vjs-target-hover",hh="vjs-hover",dv="vjs-transient-vertex",Nf="vjs-edge-click-entry-method";function t1(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function uv(i,r,e){T0(i,r);let t=r.connector;ku.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=rS(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[qe]:r.edge.id},a=t1(i,e);a!=null&&(t.bgPath==null?(t.bgPath=G(ee,s),L(t.bgPath,i.connectorOutlineClass),ea(t.canvas,t.bgPath,0)):de(t.bgPath,s),hf(t,t.bgPath,a,!0)),t.path==null?(t.path=G(ee,s),ea(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,_S)):(t.path.parentNode!==t.canvas&&ea(t.canvas,t.path,a!=null?1:0),de(t.path,s)),hf(t,t.path,e,!1),r.detachable&&r1(r,o,i.defaults.edgeRelocateHandleSize)}}function r1(i,r,e){if(i.detachable){let t=i.connector,n={x:t.paintInfo.sx,y:t.paintInfo.sy},o=i.anchors.source.computedPosition.ox,s=i.anchors.source.computedPosition.oy;n.x+=o*e/2,n.y+=s*e/2;let a={d:`M ${n.x-e/2} ${n.y-e/2} L ${n.x+e} ${n.y-e/2} L ${n.x+e} ${n.y+e/2} L ${n.x-e/2} ${n.y+e/2} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.sourceZone==null?(t.sourceZone=G(ee,a),L(t.sourceZone,Zi),t.canvas.appendChild(t.sourceZone)):de(t.sourceZone,a);let l={x:t.paintInfo.tx,y:t.paintInfo.ty},h=$e(t,1,e),d=wt(h,l,e),u=wt(l,h,e),p={d:`M ${d[0].x} ${d[0].y} L ${d[1].x} ${d[1].y} L ${u[1].x} ${u[1].y} L ${u[0].x} ${u[0].y} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.targetZone==null?(t.targetZone=G(ee,p),L(t.targetZone,Ji),t.canvas.appendChild(t.targetZone)):de(t.targetZone,p)}}function T0(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?G(Pe,{[ve]:"0",[Ne]:"0",style:{"pointer-events":pt,position:Ke},[qe]:r.edge.id}):G(q,{[qe]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var If=class{constructor(r,e){this.container=r;c(this,"or",!0);c(this,"fe");c(this,"cl");c(this,"Mi");c(this,"dl");c(this,"ke");c(this,"_u");c(this,"rt");c(this,"ar");c(this,"Vt",{});c(this,"_n",[]);c(this,"K");c(this,"Wr");c(this,"Vi");c(this,"Gi");c(this,"$i");c(this,"ul");e=e||{init:null},this.fe=new fe,this.cl=this.Ef.bind(this),this.fe.on(r,pe,"*",this.cl),this.Mi=this.ff.bind(this),this.dl=this.yf.bind(this),this.$i=e.translate||(t=>Object.assign({},t)),this.ul=e.init}$enable(){this.or=!0}$disable(){this.or=!1}addHandler(r){let e=this.Vt[r.selector];e==null&&(this.Vt[r.selector]=[],e=this.Vt[r.selector],this._n.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.Vt[r.selector];e!=null&&(this.Vt[r.selector]=e.filter(t=>t!==r),this.Vt[r.selector].length===0&&(delete this.Vt[r.selector],this._n=this._n.filter(t=>t!==r.selector)))}Ef(r){if(!this.or||r.xf===!0)return;let e=!1;this.rt=r.target;let t=()=>{e||(e=!0,this.ul&&this.ul(r),this.ar=et(this.rt),this.ke=null,this.K=me(r),this.Vi=this.$i(this.K),this.Wr=Object.assign({},this.K),this.Gi=Object.assign({},this.Vi))};for(let n=0;n<this._n.length;n++)if($t(this.rt,this._n[n],this.container)){let o=this.Vt[this._n[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.rt,l=this.ar;if(o[s].target){if(a=this.rt.closest(o[s].target),a==null)continue;l=et(a)}if(this._u=o[s].start({pagePosition:this.K,e:r,el:a,size:l,translatedPosition:this.Vi}),this._u!==!1){this.rt=a,this.ar=l,this.ke=o[s],he(r),r.xf=!0;break}}}}this.ke!=null&&(this.fe.on(document,oe,this.Mi),this.fe.on(document,se,this.dl))}ff(r){if(!this.or)return;let e=me(r),t=this.$i(e);this.ke!=null&&(this.ke.constrainFunction&&(this.ke.usesPageCoordinates?(e=this.ke.constrainFunction(e,this.rt,{width:0,height:0},this.ar,this.Wr,r),t=this.$i(e)):t=this.ke.constrainFunction(t,this.rt,{width:0,height:0},this.ar,this.Gi,r)),this.ke.drag({e:r,el:this.rt,pagePosition:e,size:this.ar,originalPagePosition:this.K,translatedPosition:t,originalTranslatedPosition:this.Vi}),this.Wr=e,this.Gi={x:t.x,y:t.y})}yf(r){this.Wr=me(r),this.Gi=this.$i(this.Wr),this.ke!=null&&this.ke.stop({e:r,el:this.rt,pagePosition:this.Wr,size:this.ar,originalPagePosition:this.K,translatedPosition:this.Gi,originalTranslatedPosition:this.Vi}),this.le()}le(){this.fe.off(document,oe,this.Mi),this.fe.off(document,se,this.dl),this.ke=null,this.rt=null,this.ar=null,this.K=null,this.Wr=null}destroy(){Object.values(this.Vt).forEach(r=>r.forEach(e=>e.destroy&&e.destroy())),this.fe.off(this.container,pe,this.cl),this.le()}};var qu={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},ch="start",dh="center",uh="end",n1="Default",i1="Default shapes",pv="vjs-shape",Qu="vjs-shape-label",ph="vjs-shape";var o1="http://www.w3.org/2000/svg",s1="http://www.w3.org/1999/xlink",a1="svg",l1="xlink",h1="html";function Mf(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var Wo=class extends vo{constructor(r){super(r),this.namespaceHandlers[a1]=e=>document.createElementNS(o1,e.split(":")[1]),this.namespaceHandlers[h1]=e=>document.createElement(e.split(":")[1]),this.namespaces[l1]=s1}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Fd(){return Mf}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function yr(i){return new Wo(i||{})}var ep="link",tp="clone",rp="trash",mv="cross",gv="plus",Ev="circle",fv="gear",v0={x:0,y:0,width:32,height:32},mh={[tp]:{id:tp,viewBox:v0,shapes:[{tag:ee,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[ep]:{id:ep,viewBox:v0,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:He,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:ee,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:ee,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[rp]:{id:rp,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:ee,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:ee,atts:{d:"M 12 26 L 10 8"}},{tag:ee,atts:{d:"M 20 26 L 22 8"}},{tag:ee,atts:{d:"M 16 26 L 16 8.5"}}]},[mv]:{id:mv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ee,atts:{d:"M 2 2 L 30 30"}},{tag:ee,atts:{d:"M 30 2 L 2 30"}}]},[gv]:{id:gv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:ee,atts:{d:"M 16 2 L 16 30"}},{tag:ee,atts:{d:"M 2 16 L 30 16"}}]},[Ev]:{id:Ev,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:He,atts:{cx:16,cy:16,r:15}}]},[fv]:{id:fv,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:ee,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function c1(i,r){let e=typeof i=="string"?mh[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function np(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=G(Pe,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=G(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function ip(i,r,e,t,n,o,s){return np(mh[i],r,e,t,n,o,s)}var d1={x:0,y:0,width:32,height:32},u1={stroke:"currentColor",fill:"none"},Vf=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return mh[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||mh[r];if(!n){this.innerHTML="";return}let o=n.viewBox||d1,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=pn(pn({},u1),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",Vf);var p1="label",C0="transform",P0="x",_0="y",op="origin",xv="originX",bv="originY",O0="orientation",Av="size",Sv="key",R0="iconId",gh="middle",yv="type",Gf="category",Tv="horizontal",m1="vertical",sp="vjs-shape-icon",L0="vjs-include-icon",w0="vjs-include-icons",g1="category",E1="type",qi="__vjsRootSet",Ki=p1,$f="fill",Eh="outline",fh="outlineWidth",Bf="color",yh="#FFFFFF",Zo="#000000",xh=2,vv="#000000",D0=.8,ia=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",yr({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${sp}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||E1,this.categoryParameter=e.categoryParameter||g1,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||D0,this.labelPosition=e.labelPosition||"center",this.bf(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:xe,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.Af(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||Ki)}bf(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=fs(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,qi),parent:null,id:qi,name:qi,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.Sf()):t.template}getCompiledShape(r,e){let t=this.Tf(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}vf(r){r.setAttribute&&r.setAttribute(Cu,Pu),r.hasChildNodes&&r.childNodes.forEach(e=>this.vf(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||Ki;let l=G(Qe,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":gh,"dominant-baseline":gh,class:Qu,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}Tf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}Cf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:gh,dominantBaseline:gh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:gh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:gh,dominantBaseline:"auto"}}[r]}Pf(r,e,t=Ki){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:m,y:g,transform:E,textAnchor:y,dominantBaseline:x}=this.Cf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Fu}>${s.template}</svg:g><svg:g ${Uu}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${m}" y="${g}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${Qu}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${xe}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=Ki,s=yh,a=Zo,l=Zo,h=xh){return e=e||h,{template:r?`<svg:g class="${ph}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
+
<r-fragment key="${Gf}:${yv}"/>
|
|
6
|
+
</svg:g>`:`<svg:svg class="${ph}" fill="{{fill}}" stroke="{{outline}}" viewBox="0 0 {{width}} {{height}}" preserveAspectRatio="none" stroke-width="{{outlineWidth}}">
|
|
7
|
+
<r-fragment key="${Gf}:${yv}"/>
|
|
8
|
+
</svg:svg>`,fragments:{[`${Gf}:${yv}`]:this.Pf(t,n,o)},defaultNamespace:"svg",decorator:(d,u)=>d.fill==null||d.outline==null||d.color==null||d.outlineWidth==null||d.fontSize==null||d.fontStyle==null?{fill:d.fill||s,outline:d.outline||a,color:d.color||l,outlineWidth:d.outlineWidth||h,fontSize:d.fontSize,fontStyle:d.fontStyle}:null,defaultableFragmentKeys:[Gf],rendered:(d,u,p,m)=>{this.refresh(d,u,o)},updated:(d,u,p)=>{this.refresh(d,u,o)},mounted:(d,u,p,m)=>{this.$applyMultilineLabel(d.querySelector(z(Qu)),u,o)}}}Sf(){return'<svg:rect x="0" y="0" width="{{width}}" height="{{height}}"/>'}Ru(r,e){return e!=null?this.iconSpecs.get(e).get(r):this.iconList.find(t=>t.id===r)}$applyMultilineLabel(r,e,t){if(this.multilineLabels&&r!=null){let n=e.width,o=e.height;if(r!=null&&n!=null&&o!=null){let s=this.labelFillRatio*n;Bu(r,e[t],s)}}}Af(r,e){Array.from(r.querySelectorAll(`svg.${sp}:not(:scope .vjs-group *, :scope .vjs-node *)`)).forEach(t=>t.parentNode.removeChild(t)),Array.from(r.querySelectorAll(L0)).forEach(t=>{let n=t.getAttribute(Sv),o=n!=null?e[n]:t.getAttribute(R0);if(o!=null){let s=this.Ru(o,e.category);if(s!=null){let a=parseFloat(t.getAttribute(P0))*e.width,l=parseFloat(t.getAttribute(_0))*e.height,h=Math.min(e.width,e.height),d=parseFloat(t.getAttribute(Av))*h,u=t.getAttribute(xv)||t.getAttribute(op)||ch,p=t.getAttribute(bv)||t.getAttribute(op)||ch,m=np(s,d,d,[sp],{[Cu]:Pu,x:a,y:l},r),g=u===dh?-d/2:u===uh?-d:0,E=p===dh?-d/2:p===uh?-d:0;m.setAttribute(C0,`translate(${g}, ${E})`)}}}),Array.from(r.querySelectorAll(w0)).forEach(t=>{let n=t.getAttribute(Sv),o=e[n];if(o!=null&&o.length>0){let s=Math.min(e.width,e.height),a=parseFloat(t.getAttribute(Av))*s,l=t.getAttribute(xv)||t.getAttribute(op)||ch,h=t.getAttribute(bv)||t.getAttribute(op)||ch,d=G(q),u=(t.getAttribute(O0)||Tv)===Tv;r.appendChild(d);let p=0,m=5,g=0;o.forEach(T=>{let S=this.Ru(T,e.category);S!=null&&(np(S,a,a,[sp],{[Cu]:Pu,x:p,y:g},d),u?p+=a+m:g+=a+m)});let E=parseFloat(t.getAttribute(P0))*e.width,y=parseFloat(t.getAttribute(_0))*e.height,x=u?p-m:0,f=u?0:g-m,b=l===dh?-x/2:l===uh?-x:0,A=h===dh?-f/2:h===uh?-f:0;d.setAttribute(C0,`translate(${E+b}, ${y+A})`)}})}parseDefs(){let r=[];return this.rootSet.children.forEach(e=>{if(e.defs)for(let t in e.defs){let n=this.templateRenderer.parse(e.defs[t]);n[0].atts.id=t,r.push(n)}}),r}getDefsElements(){return this.parseDefs().map(r=>this.templateRenderer.render(r,{}).fragment.childNodes[0])}getSvgDefsElement(){let r=G(Pe),e=G(oT);return r.appendChild(e),this.getDefsElements().forEach(t=>{e.appendChild(t)}),r}};var f1={id:"flowchart",name:"Flowchart",shapes:[{type:"process",label:"Process",description:"A process (also known as 'Action') can represent a single step or a sub-process",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"decision",label:"Decision",template:'<path d="M {{width/2}} 0 L {{width}} {{height/2}} L {{width/2}} {{height}} L 0 {{height/2}} Z"/>'},{type:"terminus",label:"Terminus",description:"Used to mark the start/end of the system",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/6}}"/>'},{type:"input",label:"Input/Output",description:"Represents something entering or leaving the system",template:'<path d="M {{width / 7}} 0 L {{width}} 1 L {{width - (width/7)}} {{height}} L 1 {{height}} Z"/>'},{type:"document",label:"Document",description:"A printed document or report",template:'<path d="M 0 {{height-(height/8)}} C {{width - (width/4)}},{{height + (height/8)}} {{width- (width/3)}},{{height/2}} {{width}},{{height-(height/8)}} L {{width}} 0 L 0 0 L 0 {{height-(height/8)}}"/>'},{type:"manualInput",label:"Manual Input",template:'<path d="M 0 {{height}} L 0 {{height/3}} L {{width}} {{height/9}} L {{width}} {{height}} Z"/>'},{type:"manualOperation",label:"Manual Operation",template:'<path d="M 0 0 L {{width}} 0 L {{width- (width/8)}} {{height}} L {{width/8}} {{height}} Z"/>'},{type:"preparation",label:"Preparation",template:'<path d="M 0 {{height/2}} L {{width/8}} 0 L {{width- (width/8}} 0 L {{width}} {{height/2}} L {{width-(width/8)}} {{height}} L {{width/ 8}} {{height}} Z"/>'},{type:"connector",label:"Connector",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"merge",label:"Merge",template:'<path d="M 0 0 L {{width}} 1 L {{width/2}} {{height}} Z"/>'},{type:"collate",label:"Collate",template:`<g><path d="M 0 0 L {{width}} 0 L {{width/2}} {{height/2}} Z"/>
|
|
9
9
|
<path d="M 0 {{height}} L {{width}} {{height}} L {{width/2}} {{height/2}} Z"/>
|
|
10
10
|
</g>`},{type:"subroutine",label:"Subroutine",template:`<g>
|
|
11
11
|
<rect x="0" y="0" width="{{width}}" height="{{height}}"/>
|
|
@@ -27,7 +27,7 @@ var pc=Object.defineProperty,bD=Object.defineProperties,CO=Object.getOwnProperty
|
|
|
27
27
|
<path d="M {{width}} {{height/5}} A {{width/2}} {{height/5}} 0 0 1 0 {{height/5}}" fill="none"/>
|
|
28
28
|
<path d="M {{width}} {{height/ 3}} A {{width/2}} {{height/ 5}} 0 0 1 0 {{height/ 3}}" fill="none"/>
|
|
29
29
|
</g>
|
|
30
|
-
`},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var
|
|
30
|
+
`},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var bxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 85 L 45 15 L 55 15 L 80 85 M 30 60 L 70 60" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><svg:path d="M 15 85 L 30 85 M 70 85 L 85 85" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round"/></svg:svg>',y1='<svg:svg viewBox="0 0 100 100"><svg:rect x="10" y="10" width="80" height="80" rx="5" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="8,4" opacity="0.6"/><svg:path d="M 35 75 L 48 30 L 52 30 L 65 75 M 40 62 L 60 62" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',Axe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 35 20 L 65 20 M 50 20 L 50 80 M 35 80 L 65 80" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:path d="M 70 50 L 78 30 L 86 50 M 73 45 L 83 45" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',Sxe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 20 L 60 20 L 85 45 L 85 80 L 20 80 Z" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"/><svg:circle cx="35" cy="35" r="5" fill="currentColor"/><svg:line x1="35" y1="55" x2="70" y2="55" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:line x1="35" y1="68" x2="60" y2="68" stroke="currentColor" stroke-width="6" stroke-linecap="round"/></svg:svg>',Cv={id:"basic",name:"Basic",shapes:[{type:"rectangle",label:"Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"rounded-rectangle",label:"Rounded Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/10}}"/>'},{type:"ellipse",label:"Ellipse",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"diamond",label:"Diamond",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height/2}} {{width/2}} {{height}} 0 {{height /2}}"/>'},{type:"isosceles-triangle",label:"Isosceles Triangle",template:'<polygon points="{{width/2}} 0 {{width}} {{height}} 0 {{height}}"/>'},{type:"inverted-isosceles-triangle",label:"Inverted Isosceles Triangle",template:'<polygon points="{{width/2}} {{height}} {{width}} 0 0 0"/>'},{type:"right-triangle",label:"Right Triangle",template:'<polygon points="0 0 0 {{height}} {{width}} {{height}}"/>'},{type:"label",label:"Label",icon:y1,template:`<g>
|
|
31
31
|
<r-if test="!text">
|
|
32
32
|
<svg:rect x="0" y="0" width="{{width}}" height="{{height}}" stroke="#888" stroke-dasharray="2" stroke-width="1" fill="{{'transparent'}}"/>
|
|
33
33
|
</r-if>
|
|
@@ -40,50 +40,50 @@ var pc=Object.defineProperty,bD=Object.defineProperties,CO=Object.getOwnProperty
|
|
|
40
40
|
<r-if test="scaled === false">
|
|
41
41
|
<svg:text dominant-baseline="hanging" stroke="none" fill="{{color}}" font-size="{{fontSize}}" font-style="{{fontStyle}}">{{text}}</svg:text>
|
|
42
42
|
</r-if>
|
|
43
|
-
</g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var na=class extends Cc{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var rp=class extends na{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var np=class extends na{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(z(e)||K(e))&&e.group==this.group}};var ip=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?Ve.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var op=class extends Gd{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new ip(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function li(i){return Xr(i)&&i.useHTMLElement!==!0}function Wo(i){return i.isSimpleShape}function QV(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function e1(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function ia(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=ql.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return Xo(r,i),i.textElement}function fh(i,r){return ql.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var oa=class extends Cu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"I");c(this,"il");c(this,"fu");c(this,"Tn");c(this,"rr");c(this,"Ve");c(this,"nr");c(this,"yu");c(this,"ge");c(this,"ol");c(this,"xu",new Set([wl,No,Io,nu,Gi,iu,Uo]));c(this,"rt",null);c(this,"Di",[]);if(o=o||{},a=a||{},this.ge=new fe,this.clipboard=new op(this),this.I=s,this.containerType=Gu(this.getContainer()),this.yu=a.hoverEvents!==!1,this.nr=Xl,this.il=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.fu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.ol=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new wu(this,{edgeMappings:o.edges.propertyMappings})),this.Tn=[],this.bu(),this.on(n,"animationend",Y($i,Mo),h=>{let d=h.target;d.style.animation=null,F(d,mf)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ve=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,_t);if(p!=null){let g={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},m=this.viewport.getElement(p);m!=null&&(m.width!==g.width||m.height!==g.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new ra(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||KT,h),this.sf(),this.af()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(e.modelObject)||z(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(Rt(n.parentElement)){let s=He(e,e.c,e.r);o(s),on(n,s),Xi(n,e.r)}else{Xi(n,e.r);let s=Dt(e);o(s),we(n,s)}t&&(this.$repaintUIElement(e),this.ie(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.xu.add(t))}$enableVertexDrag(){this.rr.$enable()}$disableVertexDrag(){this.rr.$disable()}$canDrop(e,t,n){return this.ol!=null?this.ol(e,t,n):!0}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.I.usesWrapperElement&&t.firstElementChild!=null&&this.xu.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new rp(this)}$createGroupLayoutAdapter(e){return new np(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}sf(){this.rt=this.getShapeLibrary().getSvgDefsElement(),this.rt.style.position="absolute",this.rt.style.width="1px",this.rt.style.height="1px",this.rt.style.left="-10000px",this.rt.style.top="-10000px",this.getContainer().appendChild(this.rt)}af(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===ie.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}lf(e,t,n){let s=["edge",t].join(":");if(n.hf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.wi(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.I.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Cr:pt}$doVertexUpdated(e){this.I.reactive===!1&&this.I.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.I.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.me,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.me,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(Xl);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return sT(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return nn(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){af(e,t)}$updateElementClasses(e,t,n){$t(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.ge.on(a,t,n):this.ge.on(a,t,n,o)};return wn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return wn(e)?e.forEach(o=>this.ge.off(o,t,n)):this.ge.off(e,t,n),this}trigger(e,t,n,o,s){this.ge.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return zi(e)}df(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=sn(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=Uu(n,this.getContainer(),!0);if(H(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=Uu(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=He(h,l,a.r);return He(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=He(a,s,e.r);return He(s,l,-e.r)}return s}else{if(n.namespaceURI===Mt){let l=n.closest(Pe);l!=null&&l!==n&&(o=Uu(n,l,!0),n=l)}let s=this.getContainer(),a=sn(n,t);if(this.df(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,of):sS,h=this.$getStyle(n,of);h!==st&&h!==yE&&l!==st&&l!==yE&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){_r(e,t,n)}$setElementWidth(e,t){PT(e,t)}$setElementHeight(e,t){OT(e,t)}$getSize(e){return et(e)}$setElementRotation(e,t){Xi(e,t)}$getElementPositionInUIRelativeToParent(e){return sn(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==$x?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,rT);return t&&t.length>0?t[0]:this.I.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return aT.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?Rt(e.el.parentElement)?_T(e,t):we(e.el,t):we(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,wl):this.$setAttribute(n.el,wl,Tt))}isDraggable(e){let t=this.$getAttribute(e,wl);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}wi(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||RE}ds(e,t){let o=Zt(zo(t),Ln,this.getContainer(),!0).jtk.overlay;o&&this.lf(o,e,t)}uf(e){this.ds(Fe,e)}pf(e){this.ds(fo,e)}mf(e){this.ds(W,e)}gf(e){this.ds(Br,e)}us(e,t,n){if(!n.defaultPrevented&&n.hf==null){let o=Zt(zo(n),Hr,this.getContainer(),!0);this.wi(e,t,o.jtk.connection,n,null)}}Ef(e){this.us(Fe,Db,e)}ff(e){this.us(fo,Nb,e)}yf(e){this.us(W,Gb,e)}xf(e){this.us(Br,Ib,e)}Au(e,t){let o=Zt(zo(t),Ln,this.getContainer(),!0).jtk.overlay;o&&this.Su(o.connection,e,t)}bf(e){this.Au(!0,e)}Af(e){this.Au(!1,e)}Su(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(qe)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(qe)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(qe)===e.edge.id)return}this.$setConnectorHover(e,t),t?($t(e.sourceElement,[vf]),$t(e.targetElement,[Cf])):($t(e.sourceElement,[],[vf]),$t(e.targetElement,[],[Cf]));let a=t?ot:it,l=t?xd:yd;this.wi(a,l,e,n,null)}}Tu(e,t){var o;let n=zo(t).parentNode;this.Su((o=n.jtk)==null?void 0:o.connection,e,t)}Sf(e){this.Tu(!0,e)}Tf(e){this.Tu(!1,e)}vu(e,t){let n=zo(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(ji)&&!o.classList.contains(Hi)){let s=e?se:pe,a=e?Mb:El;this.wi(s,a,n.jtk.connection,t,null)}}}vf(e){this.vu(!0,e)}Cf(e){this.vu(!1,e)}Of(e){let t=zo(e).parentNode;t.jtk&&t.jtk.connection&&this.wi(xt,Vb,t.jtk.connection,e,null)}Pf(e){let t=this.getModelObjectFromElement(e.target,!0,!1);if(t!=null)return{el:t.el,obj:t.obj,e,model:this.model,ui:this}}ir(e,t,n){if(!e.defaultPrevented){let o=this.Pf(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):z(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}_f(e){this.ir(e,Fe,vb)}Rf(e){this.ir(e,fo,Cb)}Lf(e){this.ir(e,W,wb)}wf(e){this.ir(e,Br,Pb)}Df(e){this.ir(e,xt,Lb)}Nf(e){this.ir(e,it,Ob)}If(e){this.ir(e,ot,_b)}Mf(e){this.ir(e,oe,Rb)}Vf(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&z(t.obj)&&this.toggleGroup(t.obj)}Gf(e,t,n){let o=n.bind(this);this.Tn.push({eventName:e,handler:o}),this.ge.on(this.getContainer(),e,t,o)}addDragHandler(e){this.rr==null?this.Di.push(e):this.rr.addHandler(e)}$f(){this.rr!=null&&this.rr.destroy(),this.Di=this.Di||[],this.rr=new Of(this.me,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.Cu(e)}),this.Di.forEach(e=>this.rr.addHandler(e)),this.Di.length=0}Cu(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=ae(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.ps(de.objectType,this.getContainer())}$getGroupsInViewport(){return this.ps(ie.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return Rn()}$isArrayLike(e){return super.$isArrayLike(e)||wn(e)}ps(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),Je(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}bu(){if(this.Tn!=null){this.sl();let e=[[Fe,Ln,this.uf],[fo,Ln,this.pf],[W,Ln,this.mf],[Br,Ln,this.gf],[Fe,Hr,this.Ef],[fo,Hr,this.ff],[W,Hr,this.yf],[Br,Hr,this.xf],[Fe,this.nr,this._f],[fo,this.nr,this.Rf],[W,this.nr,this.Lf],[Br,this.nr,this.wf],[W,nT,this.Vf],[xt,Hr,this.Of],[se,Hr,this.vf],[pe,Hr,this.Cf],[xt,Xl,this.Df]];this.yu===!0&&e.push.apply(e,[[ot,Hr,this.Sf],[it,Hr,this.Tf],[ot,Ln,this.bf],[it,Ln,this.Af],[it,this.nr,this.Nf],[ot,this.nr,this.If],[oe,this.nr,this.Mf]]),e.forEach(t=>{this.Gf(t[0],t[1],t[2])})}}sl(){let e=this.getContainer();e&&this.Tn!=null&&(this.Tn.forEach(t=>{this.ge.off(e,t.eventName,t.handler)}),this.Tn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.sl(),this.$setAttribute(e,rf,G().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(rf),Array.from(t.childNodes).filter(o=>o!=null&&(nn(o,ks)||nn(o,Ws)||o.getAttribute&&o.getAttribute(_t)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Gu(e),this.ge!=null&&(this.$f(),this.bu())}reset(){super.reset(),this.Ve&&this.Ve.disconnect(),this.getContainer().querySelectorAll([Xl,Hr,Ln].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.rt!=null&&this.rt.parentNode!=null&&this.rt.parentNode.removeChild(this.rt),this.sl(),super.destroy()}$__unmanage(e,t,n){this.Ve!=null&&this.Ve.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(Wo(e))Ql(this,e).map(n=>L(n,t));else if(li(e))Xo(this,e).map(n=>L(n,t));else if(Xr(e))L(ia(e,this),t);else if(rn(e))L(fh(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(Wo(e))Ql(this,e).map(n=>F(n,t));else if(li(e))Xo(this,e).map(n=>F(n,t));else if(Xr(e))F(ia(e,this),t);else if(rn(e))F(fh(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.al(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.al(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.al(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(z(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}al(e){return e!=null&&e.template&&e.templateId==null&&this.I.addTemplate&&(e.templateId=G(),this.I.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.I.recado!=null&&this.I.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),g=a,m;g=Object.assign({},l?l.parameters||{}:{}),Object.assign(g,a);let E={};for(m in g)g.hasOwnProperty(m)&&g[m]!=null&&(g[m].constructor==Function?E[m]=g[m](a):E[m]=g[m]);if(g=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(g,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);g[this.$modelWidthAttribute]=x.width,g[this.$modelHeightAttribute]=x.height}d?this.I.rerender(y,g,this.model,e,this,l,s,h,u):this.I.render(y,g,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.il(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.il(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.fu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(Wo(e))AT(this,e,t,n);else if(li(e))ST(this,e,t,n);else if(Xr(e)){ia(e,this);let o=t,s=e;this.Ou(s,o,e.rotatable!=null)}else if(rn(e)){fh(e,this);let o=t,s=e;this.Ou(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}Ou(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+Pn,e.contentElement.style.top=t.d.miny+Pn,n&&Xi(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,Il):L(o,Il))}if(Wo(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else li(e)?e.contentElements&&e.contentElements.forEach(n):Xr(e)?n(ia(e,this)):rn(e)&&n(fh(e,this))}$reattachOverlay(e,t){Wo(e)?Ql(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):li(e)?Xo(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):Xr(e)?this.$appendElement(ia(e,this),this.getContainer()):rn(e)&&this.$appendElement(fh(e,this),this.getContainer())}$setOverlayHover(e,t){let n;Wo(e)?n=Ql(this,e):li(e)?n=Xo(this,e):Xr(e)?n=[ia(e,this)]:rn(e)&&(n=[fh(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{$t(o,t?[sh]:[],t?[]:[sh])}),this.$setHover(e.connection,t))}destroyOverlay(e){Wo(e)&&e instanceof Fu?hf(e):li(e)?hf(e):xT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):rn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(Wo(e))return e.draw(t,n,o);if(li(e)){let s=dr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(X(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let g=dr(t,u,p),m=Ye(t,u,.01,p);d=Ja(Za(g,m)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=Ja(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(Xr(e)||rn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=dr(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=dr(t,d,u),g=Ye(t,d,.01,u);h=Ja(Za(p,g)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=Ja(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=ia(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){JT(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&$t(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),$t(o,t?[sh]:[],t?[]:[sh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.Qo===Fi&&this.setOverlayVisible(s,t)}),this.ut||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&e1(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){QV(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&this.I.cleanupVertex(e.node.id,t.el),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.I.cleanupVertex(e.group.id,t.el),t}addClass(e,t){e.constructor===hr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.ll(e,t,L)}removeClass(e,t){e.constructor===hr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.ll(e,t,F)}toggleClass(e,t){e.constructor===hr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.ll(e,t,af)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?nn(n.el,t):Yi(e)?nn(e,t):!1}}ll(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):Yi(s)&&n(s,t)};e!=null&&(wn(e)?n(e,t):oT(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){Wt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Rt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ve!=null&&this.Ve.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Zt(e,be(en),this.getContainer(),!0)||Zt(e,be(ee),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!tt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,g={},m=t?Vi:Gi;if(o=e.getAttribute(m)||e.getAttribute(Yr),!H(l)){let E=t?[Hs,AE]:[Io,nu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(en)||e.getAttribute(Dl),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?g=this.view.getPortDefinition(o):g=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:g,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return Yi(e)}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(ee);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(en)||s.getAttribute(Hs)||s.getAttribute(Io);if(h!=null){let d=Zt(s,be(_t),this.me,!1);if(d!=null){let u=d.getAttribute(_t),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let g=s.getAttribute(Yr)||s.getAttribute(Vi)||s.getAttribute(Gi)||xe;return{obj:p.$addPort({id:h,type:g}),el:s,missingPortCreated:!0}}else{let g=p.getPort(h);return g==null?null:{obj:g,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.me?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(si(en,n[1]))||o.querySelector(si(Io,n[1]))||o.querySelector(si(Hs,n[1]))||o:null}$isSupportedElement(e){return Yi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=B(Pe,a,o,s);return _r(l,t.width,t.height),this.containerType==="SVG"?on(l,e):we(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(X(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(en,n[1])||s(Hs,n[1])||s(Io,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(en)===n[1]||o.getAttribute(Hs)===n[1]||o.getAttribute(Io)===n[1]||o.getAttribute(Dl)===n[1]||o.getAttribute(AE)===n[1]||o.getAttribute(nu)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),g=Math.max(d,Math.abs(n.y-t.y)),m=B(Pe,{viewBox:`0 0 ${p} ${g}`});m.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:g,x=t.x>n.x?0:p,f=t.y>n.y?0:g,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:g},type:vn,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(R,v,O)=>{let[P,I]=X(R)?[R,{}]:[R.type,R.options],C=ho(I,l,"_");C.location=v,C.direction=O;let _=at.get(this,P,{instance:this},C),w=this.$drawOverlay(_,A,{stroke:u,fill:u});if(_.isSimpleShape){let $=_,N=w;$.contentTags.forEach((M,D)=>{let V=B(M,N.atts[D]);m.appendChild(V)})}else if(li(_)){let $=_,N=w;$.contentElements.forEach(M=>{on(M,N.d.loc),m.appendChild(M)})}else if(rn(_)){let $=_,N=w;$.contentElements.forEach(M=>{on(M,N.d.loc),m.appendChild(M)})}return w};if(s!=null){let R=T(s,0,-1);E=R.tail.x,y=R.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let R=T(a,1,1);x=R.tail.x,f=R.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=B(te,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return m.appendChild(S),o.forEach(R=>{let[v,O]=X(R)?[R,{}]:[R.type,R.options],P=ho(O,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let _=I,w=C;_.contentTags.forEach(($,N)=>{let M=B($,w.atts[N]);m.appendChild(M)})}else if(li(I)){let _=I,w=C;_.contentElements.forEach($=>{on($,w.d.loc),m.appendChild($)})}else if(Xr(I))if(I.useHTMLElement){let _=C,w=I.contentElement;h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}else{let _=B(te,C.atts[0]);m.appendChild(_)}else if(rn(I)){let _=C,w=I.create(null,null,this,this.model);w.style.position=st,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${_.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${_.d.cxy.y}px)`}}),h.appendChild(m),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=z(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=z(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Rt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&Yi(o)&&(t?o.removeAttribute(gr):o.setAttribute(gr,ct)),t}flashVertex(e,t=1e3,n=DT){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,mf))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof hr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var sa=`<div data-vjs-vertex="{{id}}" class="${$i} ${Af}">{{label}}</div>`,gL="<div/>",mL=`<div data-vjs-vertex="{{id}}" class="${Mo} ${Sf}">{{label}}</div>`,aa=`<svg:rect data-vjs-vertex="{{id}}" class="${$i} ${Af}" x="0" y="0" width="80" height="60"/>`,EL='<svg:rect x="0" y="0" width="100%" height="30"/>',fL=`<svg:rect data-vjs-vertex="{{id}}" class="${Mo} ${Sf}" x="0" y="0" width="300" height="250"/>`,t1={html:{"vjs-node-default":sa,"vjs-group-default":mL,"vjs-port-default":gL},svg:{"vjs-node-default":aa,"vjs-group-default":fL,"vjs-port-default":EL}},cv=(i,r)=>t1[i][r],sp=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=fr({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.oe(h),this.render(r,e,t,n,o,s,a,l)}oe(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.oe(e)}cleanupPort(r,e){this.oe(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.oe(r)}};function yh(i,r,e){let t=n=>cv(r?"svg":"html",n)||_f(n)||i;return new sp(i,t,e)}var r1="pointerdown",n1="pointermove",i1="pointerup",o1="touchstart",yL="touchmove",xL="touchend";function bL(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var ap=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=bL(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.Vr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.Pu())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Vr(this.onPinch))};this.bind(r.el,r1,a,{passive:!1}),this.bind(document,i1,l,{passive:!1}),this.bind(document,n1,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return bL(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,yL,h),this.bind(document,xL,l),le(d),this.Vr(this.onPinchStart))},l=d=>{s=!1,le(d),this.unbind(document,yL,h),this.unbind(document,xL,l),this.Pu()},h=d=>{if(s){let u=e(d);u.length===2&&(le(d),this.radius=n(u),this.center=o(u),this.Vr(this.onPinch))}};this.bind(r.el,o1,a)}});this.eventManager=new fe,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}Vr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}Pu(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var lp=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}Bf(r,e){if(e===Q){let t=r.pos[e];if(r.alignX===Et){let n=et(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=et(r.el);return t-n.height}return t}}cl(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.Bf(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(ze,"x",(a,l)=>{vT(a,l),o.currentPosition.x=l}),s(Se,"y",(a,l)=>{CT(a,l),o.currentPosition.y=l})}}pan(){this.cl()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Rt(this.panZoom.canvasElement)&&!Rt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||ze,alignY:t.alignY||Se,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Rt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this.cl(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this.cl())}destroy(){this.panZoom=null,this.fixedElements=null}};var s1="transformOrigin",AL="transform",a1="translateX",l1="translateY",h1="scale",SL="px",vL="vjs-pan-zoom",CL="vjs-pan-zoom-canvas";function la(){}function TL(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var ha=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"_u");c(this,"Dt");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"hl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"dl");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Xr");c(this,"vn");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"ul");c(this,"pl");c(this,"Ni");c(this,"ml");c(this,"gl");c(this,"viewport");c(this,"ms");c(this,"Ve");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"Ii",{});c(this,"El",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.Wf===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=ge(r),this.Xr=this.$_getViewportSize(),this.or(),this.Iu(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.Hf(r)&&(this.Xr=this.$_getViewportSize(),this.or(),this.panning=!0,this.aboutToPan=!0,this.downAt=ge(r),this.canvasAtPanStart=Object.assign({},this.position),le(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=ge(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.Sl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){le(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=ge(r),t=(o.x-this.downAt.x)/this.ms,n=(o.y-this.downAt.y)/this.ms;let s=this.nt({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),le(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Xr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,oe,this.ul),this.eventManager.off(document,se,this.pl),this.eventManager.on(document,oe,this.Ni),this.onMouseUp(r,this))},[xt]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||SS,this.hl=r.zoomStep||.25,this.fixedLayer=new lp(this,r.elementPositionSetter),this.eventManager=new fe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ve=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.or()})}),this.Ve.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.nt({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,vL),L(this.canvasElement,CL),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||la,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||la,this.onPanStart=r.events.panStart||la,this.onMouseDown=r.events.mousedown||la,this.onMouseUp=r.events.mouseup||la,this.onMouseMove=r.events.mousemove||la,this.onSetTransformOrigin=r.events.transformOrigin||la,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.dl=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let e=r.wheel||{};this.enableWheelZoom=e.zoom!==!1,this.wheelFilter=e.filter||(()=>!0),this.wheelCssFilterSpec=e.cssFilter,this.wheelZoomRequiresMetaKey=e.useMetaKey===!0,this.wheelDirection=e.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(e.sensitivity||10),this.wheelPan=e.pan===!0,this.wheelPanAxis=e.axis||"both",this.Ru(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.ul=function(t){this.fl("move",t)}.bind(this),this.pl=function(t){this.fl("end",t)}.bind(this),this.Ni=function(t){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Dt=(t,n,o,s)=>this.wheelPanOrZoom(t,n,o,s),Wl(this.viewportElement,this.Dt,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new ap({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(t,n,o,s)=>{this.W(s*this.zoomAtZoomStart);let a=t.x-this.downAt.x,l=t.y-this.downAt.y;this.nt({x:this.canvasAtPanStart.x+a,y:this.canvasAtPanStart.y+l,animate:!1})},onPinchStart:(t,n)=>{this.pinchZooming=!0,this.downAt=t,this.distanceAtZoomStart=this.lastDistance=n,this.zoomAtZoomStart=this.zoom,this.yl(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.W(this.zoom,null,!1,!1,!0),this.xl(),this.background=new dv,r.background&&this.background.addBackground(r.background),this.ml=t=>{this.start(t)},this.eventManager.on(this.viewportElement,pe,this.ml),this.eventManager.on(document,oe,this.Ni),this.gl=t=>{this.fl(xt,t)},this.eventManager.on(this.viewportElement,xt,this.gl),this.or(),this.$computeCompoundZoom()}getCompoundZoom(){return this.ms}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.Ru())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.ms=e.width/r.width}$_getViewportSize(){return this.Xr=et(this.viewportElement),this.Xr}or(){return this.vn=et(this.canvasElement),this.vn}Ru(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!Gt(e,this.wheelCssFilterSpec)})}Ff(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=g=>{u||(u=g);let m=g-u,E=m/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,m<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}nt(r){let e=this.Lu(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.wu(r.zoom);this.Ff(t,e.x,e.y,r.animationDuration)}else this.position=e,this.Du(null,r.onComplete);else this.position=e,this.Al(),r.onComplete&&r.onComplete(this.position);return this.position}Nu(r,e,t,n,o){let s=this.position;return this.nt({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}Uf(r,e,t,n){n||this.pan(-e*100,-t*100)}zf(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.Iu(r),this.zoomingWithWheel=!0),this.Sl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.zf(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===Q?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===Ee?t:0,this.Uf(r,e,t,n)))}Yf(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}Mu(){return`${h1}(${this.zoom}) ${a1}(${this.position.x/this.zoom}${SL}) ${l1}(${this.position.y/this.zoom}${SL})`}Al(){this.canvasElement.style[AL]=this.Mu()}Du(r,e){if(this.canvasElement.animate!=null){let t={[AL]:this.Mu()};this.Yf(t,r,e)}else this.Al()}Xf(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}xl(){this.canvasElement.style[s1]=this.Xf()}jf(r,e){let t=this.fromPageLocation(r,e),n=this.vn||this.or();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}Vu(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.xl(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.Nu(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}yl(r,e){if(this.fixedTransformOrigin==null){let t=this.jf(r,e);this.Vu(t.o,t.width,t.height)}}Iu(r){if(this.fixedTransformOrigin==null){let e=ge(r);this.yl(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.vn||this.or();this.Vu({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}wu(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}W(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.wu(r);let s=this.zoom,a=l=>{if(!this.El&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.Lu(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.nt({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.Du(null,a)}else this.zoom=r,this.Al(),a(this.position);return this.zoom}Sl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.kf(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}kf(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.W(h,o,s)}Lu(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Xr||this.$_getViewportSize(),o=this.pt(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let m=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,m),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,g=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),g>l.vh&&(a-=g-l.vh),{x:s,y:a}}}pt(){let r=this.vn||this.or(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}Hf(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.dl!=null?this.dl(e)!==!1:!0}fl(r,e){r===xt&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Fo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,oe,this.Ni),this.eventManager.on(document,oe,this.ul),this.eventManager.on(document,se,this.pl),this.handlers.start(r,Fo(r)))}getBoundsInfo(r,e){let t=this.Xr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.Ii[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.Ii[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.Ii[e]}remove(r){let e=this.idFunction(r);delete this.Ii[e]}reset(){this.Ii={},this.nt({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.W(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.W(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.W(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.W(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||ze,o=t[1]||Se,s=this.getBoundsInfo(),a=n===ze?0:s.vw-this.background.getWidth()*this.zoom,l=o===Se?0:s.vh-this.background.getHeight()*this.zoom,h=this.pt();this.nt({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=zi(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.yl(o,s),this.W(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Sl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.vn||this.or(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.pt(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,g=this.position.x,m=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?m:r.alignY===ht?y:r.alignY===Nt?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?g:r.alignX===Et?b:r.alignX===Nt?d-a.x:f*this.zoom;this.nt({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.El||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Se,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=ze,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=Et,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:Nt,r.alignY=r.vertical===!1?null:Nt,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.pt(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.pt(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.nt({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.W(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.W(this.zoom+this.hl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.W(this.zoom-this.hl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.W(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.Nu(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.nt({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this._u=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this._u)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.xl()}fromPageLocation(r,e,t){let n=this.pt(),o=this.position,s=TL(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.pt(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.pt(),n=this.position,o=TL(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}mapEventLocation(r){let e=ge(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}getApparentCanvasLocation(){let r=this.pt(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.pt(),n=this.nt({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ve!=null&&(this.Ve.disconnect(),this.Ve=null),this.Dt!=null&&Zl(this.viewportElement,this.Dt),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,oe,this.Ni),this.eventManager.off(this.viewportElement,pe,this.ml),this.eventManager.off(this.viewportElement,xt,this.gl),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.El=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},dv=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}Nt(r){this.backgrounds.forEach(e=>e.Nt(r))}};function aTe(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),g=o+(e-o)*p;i.setZoom(g);let m={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(m.x,m.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var uv={},hp=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=sn(s.el),l=et(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},xh=class extends hp{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function c1(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new xh(s,e,t,n,o,s.incremental)}}var cp={get:(i,r,e,t,n)=>{let o=uv[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{Ex(r,hp)?uv[i]=r:uv[i]=c1(r)}};function pv(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=G()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||G()),s!=null&&a!=null)l=cp.get(s,a,r,e,h);else{let u=o;h=u.id||G(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new xh(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var Nf=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{jr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{Pr(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var gv="default",d1="center",PL="perimeter",dp=si(hS,Tt),OL=si(No,Tt);function _L(i){return RL(i,OL)}function RL(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function up(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function pp(i,r,e,t){let n=null,o=i.getEffectiveVisibleZoom();for(let s=0;s<r.length;s++)if(Je(e,r[s].r)){n=r[s];let a=r[s].modelInfo.typeDef,l=r[s].modelInfo.objEl,h=$u(t,l,o);r[s].positionOnElement=h,a.anchorPositionFinder!=null?r[s].anchor=a.anchorPositionFinder(l,h,n.modelInfo.vertex,a):r[s].anchor=null;break}return n}function u1(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function bh(i,r,e,t,n,o){return mv(i,r,e,!1,t,n,o)}function Ev(i,r,e,t,n,o){return mv(i,r,e,!0,t,n,o)}function mv(i,r,e,t,n,o,s){let a=[],l=[];return _L(i).forEach(d=>{if(d.getAttribute(gr)!==ct){if(s!=null&&d.getAttribute(Uo)!==s)return;let u=up(i,d,!1);if(!n&&u.obj===e)return;if(u1(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:z(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(Yr)||d.getAttribute(Gi),magnet:d.getAttribute(iu)===Tt}),L(d,mr)}else r&&(d.setAttribute(gr,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(Ke(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(Ke(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var ca=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||gv,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind(Kn,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(ud,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new Bs}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}Gu(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=$e(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=$e(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),ps(o[0],r,!0)?r:n===PL||n===gv&&(o[0].width>t||o[0].height>t)?yx(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function gp(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,$e(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var Nn="keyup",Zi="drag",Ah="click",Sh="idle",Qve="dragging",If="awaitingClick",Mf="locked",mp=class extends ca{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",Zi);c(this,"currentState",Sh);c(this,"Tl");c(this,"vl");c(this,"Cl");c(this,"Ol");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"he");this.currentMethod=e.method||Zi,this.Tl=e.Tl,this.vl=e.vl,this.Cl=e.Cl,this.Ol=e.Ol,this.tapHandler=this.Zf.bind(this),this.mousemoveHandler=this.Pi.bind(this),this.canvasTapHandler=this.Jf.bind(this),this.documentKeypressHandler=this.Pl.bind(this),this.surface.addDragHandler({selector:dp,start:t=>this.Kf(t),drag:t=>this.qf(t),stop:t=>{this.Qf(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h={x:t.x-this.scrollAtPageDown.x,y:t.y-this.scrollAtPageDown.y},d=this.surface.getEffectiveVisibleZoom(),u=this.Gu(h,this.edgeSnapThreshold*d,this.edgeSnapSizeThreshold*d,this.edgeSnapType);return{x:u.x+this.scrollAtPageDown.x,y:u.y+this.scrollAtPageDown.y}}else return t}}),this.surface.on(this.container,W,dp,this.tapHandler),this.surface.addDragSelectorFilter(dp)}oe(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,mr),H(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(gr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(document.body,Pf),F(this.surface.rootElement,Dn),this.surface.off(document,oe,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Nn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,Er),this.currentDropTarget=null),this.transientInfo!=null&&(this.he&&this.he.unobserve(this.transientInfo.el.el),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Sh}$u(e,t,n,o){var h;let s=n.getAttribute(ru)||((h=e.typeDef)==null?void 0:h.edgeType),a=ge(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:st,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},ZT);let l=Object.assign({},o||{});s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Dn),this.he&&this.he.observe(this.transientInfo.el.el)}Bu(e){return this.currentPagePosition={x:e.x,y:e.y},this.ey()}ey(){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}Fu(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:lo(t)?{}:t}}Kf(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===Zi){this.$active=!0;let t=e.el;if(t.getAttribute(gr)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=up(this.surface,t,!0);if(n!=null){let o=this.Fu(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Yr)||t.getAttribute(Vi),this.u.edgeType=t.getAttribute(ru)||"";let s=t.getAttribute(Uo);this.u.scope=s,this.$u(n,e.e,t,o.payload),L(document.body,gt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(bE)===Tt||this.allowLoopbackEdges,l=bh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),!0}}}}return!1}_l(e){if(this.transientEdge!=null){le(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=$u(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):(z(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=ge(e);n=this.surface.fromPageLocation(s.x,s.y)}this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},co,null)},()=>{})}}Qf(e){this.surface.$stopMotion(),this._l(e.e),this.$active=!1}Uu(e,t){this.ny();let n=e();if(this.currentMethod===Ah&&this.currentState==If){let s=ge(t);this.Bu(s)}let o=pp(this.surface,this.dropTargets,n,t);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,Er),o!=null){if(L(o.targetEl,Er),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=gp(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}Pi(e){let t=ge(e);this.Uu(()=>({x:t.x,y:t.y,width:5,height:5}),e)}qf(e){this.Uu(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.Bu(t);else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}ny(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Zf(e){if(this.currentMethod===Ah&&this.currentState!==Mf){let t=e.target||e.srcElement;if(t.getAttribute(gr)!==ct){let n=up(this.surface,t,!0);if(n!=null){if(this.currentState===Sh){le(e),this.$active=!0,this.pageDownAt=ge(e),this.u={};let o=this.Fu(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Yr)||t.getAttribute(Vi),this.u.edgeType=t.getAttribute(ru);let s=t.getAttribute(Uo);this.u.scope=s,this.currentSource=n.obj,L(document.body,Pf),this.$u(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(bE)===Tt||this.allowLoopbackEdges,l=bh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=If,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,oe,this.mousemoveHandler),document.addEventListener(Nn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===If){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this._l(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.oe()}Jf(e){if(!e.defaultPrevented&&this.currentMethod===Ah)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=ge(e);for(let n=0;n<this.dropTargets.length;n++)ps(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this._l(e),this.$_exitTapMode())}}Pl(e){this.currentState===If&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var fv="primed",yv="idle",xv="active",Ep=class extends ca{constructor(e){super(e);c(this,"Rl");c(this,"Ll");c(this,"It");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"Oe");c(this,"he");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"gs",!1);c(this,"jr");c(this,"Cn");this.Rl=e.inputHandler,this.Ll=e.method||Zi,this.It=yv,this.documentKeypressHandler=this.Pl.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.It===fv){this.jr=bt({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.jr),this.Cn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Dn),$t(a,[xf],[Yu]),this.gs=!0,this.It=xv,this.Rl.currentState=Mf}if(le(n),this.currentPagePosition=ge(n),this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom();this.currentPagePosition=this.Gu(this.currentPagePosition,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.iy();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=pp(this.surface,this.dropTargets,o,n);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,Er),s!=null){if(L(s.targetEl,Er),s.anchor!=null)this.jr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.jr.isFixed=!0;else if(s.positionOnElement!=null){let a=gp(s.positionOnElement);this.jr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.jr.isFixed=!0}}this.currentDropTarget=s}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(le(n),this.gs)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===nt?s:o.source,a===nt?o.target:s,o)===!1?this.wl():(this.oe(this.currentDropTarget.anchor),a===nt?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Cn.dummy===!0?(this.surface.model.updateVertex(this.Cn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.oe()):this.wl();else(this.Ll===Zi||this.It===xv)&&this.oe();else this.oe();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Zt(o.target,be(qe),this.container,!1);s!=null&&(this.currentEdge=this.surface.model.getEdge(s.getAttribute(qe)),this.currentEdge.transient?(this.$active=!1,this.currentEdge=null,this.It=yv):(this.Cn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),(this.currentConnection.detachable||this.Cn.dummy===!0)&&(this.$active=!0,this.gs=!1,this.currentIndex=n,le(o),this.Oe={x:0,y:0},this.currentPagePosition=ge(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,oe,this.mouseMoveHandler),this.surface.on(document,se,this.mouseUpHandler),this.It=fv,this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},XT),this.he&&this.he.observe(this.transientVertex.el.el),this.ly(),L(this.currentConnection.connector.canvas,Yu),this.Ll===Ah&&document.addEventListener(Nn,this.documentKeypressHandler),this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge))))}};this.surface.on(this.container,pe,Y(ji),t(nt)),this.surface.on(this.container,pe,Y(Hi),t(fn))}iy(){let e={x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(bd,this.currentEdge)}wl(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.oe();else{let n=this.currentEdge.id;this.oe(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.Oe.x,y:this.currentPosition.y+this.Oe.y},this.currentIndex):this.surface.model.removeEdge(n)}}oe(e){if(this.rtree.clear(),this.jr=null,this.dropTargets.forEach(t=>{F(t.targetEl,mr)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(gr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(this.surface.rootElement,Dn),$t(this.currentConnection.connector.canvas,[],[xf,Yu]),document.removeEventListener(Nn,this.documentKeypressHandler),this.surface.off(document,oe,this.mouseMoveHandler),this.surface.off(document,se,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,Er),this.currentDropTarget=null),this.transientVertex!=null&&(this.he&&this.he.unobserve(this.transientVertex.el.el),this.surface.$removeTransientVertex(this.transientVertex.el)),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.gs=!1,this.It=yv,this.Rl.currentState=Sh,this.Cn=null}ly(){if(this.currentIndex===nt){let e=Ev(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=bh(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}Pl(e){(this.It===xv||this.It===fv)&&(e.keyCode===27||e.key==="Escape")&&this.wl(!0)}};var yr="pan",hi="select",Zo="disabled",In="vertexDrawing";var da="vjs-anchor-placeholder",p1="vjs-anchor-candidate",Vf="vjs-connection-edit",fp="vjs-edge-guideline",Mn="vjs-edge-handle";var Gf=Y(da),bv=12,Av=15;function $f(i,r,e,t){let n=B(q,e||{});L(n,r),t||(n.style.display=pt);let o=B(Xe,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function LL(i,r,e,t,n,o,s){let a=B(q);L(a,n),s||(a.style.display=pt);let l=B(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function Sv(i,r,e,t,n,o,s){let a=$f(t,n,o,s);return i.$appendElementToToolsLayer(a),we(a,{x:r,y:e}),a}function Tv(i,r,e,t,n,o,s,a,l,h){let d=LL(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),we(d,{x:r,y:e}),d}function vv(i,r,e){let t=i.faces,n=[{face:ze,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:Et,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Se,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Se,[0,-1]),o.set(ht,[0,1]),o.set(ze,[-1,0]),o.set(Et,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function Cv(i,r,e){let t=xc(r,e,i.locations);return wL(t.p,e)}function Pv(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return wL(d,o)}}function wL(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var Ji=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"zu");c(this,"hy");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"Yu",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"ar");c(this,"lr");c(this,"Dl");c(this,"hr");c(this,"Es");c(this,"buttonSize");c(this,"Xu");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Nl");c(this,"dr");c(this,"uy",{});c(this,"ur",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||bv,this.Xu=e.anchorPlaceholderSize||Av,this.hr=!1,this.ui.model.bind(yn,()=>{this.deactivate()}),this.ui.bind(Zn,l=>{l.edge==this.currentEdge&&this.ju()}),this.eventManager=new fe,this.$addDragHandler({selector:Gf+" *",target:Gf,constrainFunction:(l,h,d,u,p,g)=>{let m=h.fs.anchor,E={x:l.x,y:l.y},y=!1,x=this.dr.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.ur.rotation!==0&&(y=!0,E=He(l,this.ur.center,-this.ur.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Nl!=null)A=Pv(m,this.Nl,x.el,b,this.dr.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(m.isContinuous){let[T,S]=vv(m,E,f);A=T,S!=null&&(m.currentFace=S),this.$hasEdits=!0}else A=Cv(m,l,f),this.$hasEdits=!0;return m.fixedLocation=A,m.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x),y&&(l=He(l,this.ur.center,this.ur.rotation)),l},start:l=>{let d=l.el.fs.vertex;if(this.dr=this.ui.getObjectInfo(d,!1),this.Yu.length=0,this.dr.obj!=null)this.Dl=this.$cloneCurrentGeometry(),this.Nl=this.currentEdge.source.id===this.dr.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.ur.rotation=this.ui.$getRotation(d.id),this.ur.rotation!==0&&(this.ur.center={x:this.dr.managedElement.t.c.x,y:this.dr.managedElement.t.c.y});else return!1},stop:l=>{this.Yu.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Dl),this.Dl=null,this.dr=null},drag:l=>{this.ju()}});let t=(l,h)=>{this.py(l)?h(l):z(l)&&(Ke(this.currentEdge.source,l)?h(this.currentEdge.source):Ke(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.hr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.my(d)})}),this.$repaint())},o=l=>{this.hr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.gy(d))})};this.ui.bind(It,l=>{o(l)}),this.ui.bind(er,l=>{n(l)}),this.ui.bind(Vr,l=>{o(l)}),this.ui.bind(Zc,l=>{n(l)});let s=l=>{this.hr&&this.currentEdge&&t(l.vertex,h=>this.Vi())};this.ui.model.bind(Me,s),this.ui.model.bind(_e,s);let a=l=>{this.hr&&this.currentEdge&&l.id===this.currentEdge.id&&(this.$repaint(),this.Mi())};this.ui.bind(bd,l=>{a(l)}),this.ui.model.bind(Qr,l=>{a(l.edge)}),this.ui.model.bind(qr,l=>{a(l.edge)})}isBusy(){return this.Es}ju(){this.Mi(),this.$repaint()}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}ku(r){return this.ui.view.getTypeDefinition(r).anchorPositions}Hu(r,e){let t={type:e.type,options:Object.assign(e.options,{id:G()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}Ey(r,e){this.Wu(),e.forEach(t=>{this.Hu(r,t)})}Wu(){this.currentOverlays.forEach(r=>{$o(this.current,r.id)})}fy(r){let e=r.deleteButtonClass||Zs,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.Hu(this.current,{type:pr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){this.current&&(this.ui.$paintConnection(this.current,r),this.Vi(r))}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Vi(r){this.current&&(this.Mi(),this.$repaint&&this.$repaint(r))}Mi(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=$f(this.Xu,da,{[qe]:this.currentEdge.id},!0),d.fs={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return we(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.ar),this.currentEdge.source.dummy||([this.sourceDimensions,this.ar]=r(0,this.ar)),this.ui.$removeElement(this.lr),this.currentEdge.target.dummy||([this.targetDimensions,this.lr]=r(1,this.lr))}}yy(){this.current&&(this.ar&&(this.ar.parentNode.removeChild(this.ar),delete this.ar.fs),this.lr&&(this.lr.parentNode.removeChild(this.lr),delete this.lr.fs)),this.ar=null,this.lr=null,this.sourceDimensions=null,this.targetDimensions=null}by(){this.current&&Ii(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.by(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.hr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;we(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this.zu=this.ui.model.getEdgeType(r.data),this.hy=this.ui.view.getEdgeDefinition(this.zu),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=Js(t.anchorPositions),this.targetAnchorPositionFinder=Js(t.anchorPositions);else{let n=this.ku(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=Js(n));let o=this.ku(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=Js(o))}this.$activate(e,t),t.overlays&&this.Ey(e,t.overlays),t.deleteButton===!0&&this.fy(t),this.Mi(),jr(this.current,Vf),this.hr=!0}}deactivate(r){this.current!=null&&(this.Wu(),Pr(this.current,Vf),this.yy()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.hr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Es=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=Sv(this.ui,r,e,t,o,{[qe]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=Tv(this.ui,r,e,t,n,o,s,a,{[qe]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=B(Qe,{x:`${t/2}`,y:`${n/2}`,[qe]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Es=!0),t},drag:e=>r.drag(e),stop:e=>{this.Es=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.uy[r.selector]=r}my(r){this.Mi(),this.$elementDragging(r)}gy(r){this.$elementDragged(r)}py(r){return this.currentEdge==null?!1:r.id===kg(this.currentEdge.source)||r.id===kg(this.currentEdge.target)}};var Rr=new Map;function g1(i,r,e){let t=Rr.get(i);return new t(r,e)}function m1(i){return i.type===Cn&&i.constrain===Kr?Xs:i.type}var ua=class{constructor(r,e){this.ui=r;this.ys=e;c(this,"Il",new Map);c(this,"Zu");c(this,"Ye",!1);c(this,"On");c(this,"it");r.bind(Oi,()=>(this.destroy(),!0)),this.ys=this.ys||{},this.Zu=this.ys.hoverMode===!0,this.ui.model.bind(yt,t=>{this.On&&this.On.id===t.edge.id&&this.stopEditing()}),this.Zu&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.On&&this.On.id===t.id&&(this.Ye=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Ye=!1}),oi()&&(this.ui.bind(xd,t=>{t.obj.transient||(!this.it||!this.it.isBusy()&&this.it.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(yd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Ye){let t=this.Ju(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=m1(t.connector);if(Rr.has(o)){if(this.it=this.Il.get(o),this.it==null){let s=Object.assign({},this.ys||{});this.it=g1(o,this.ui,s),this.Il.set(o,this.it)}this.On=n,this.it.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.it&&this.it.deactivate(),this.On=null,this.it=null}clearEdits(r){let e=this.Ju(r);return e!=null?(Ii(e),!0):!1}Ju(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):Ks(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.Il.clear()}};function Ov(){}function yp(i){let r=document.createElement("div");return L(r,i.join(" ")),document.body.appendChild(r),r}var pa=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"xs");c(this,"el");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"ct");c(this,"eventManager");c(this,"Ml");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",pe);c(this,"upEvent",se);c(this,"moveEvent",oe);c(this,"enabled",!1);c(this,"Ku");this.surface=r.surface,this.onStart=r.onStart||Ov,this.onEnd=r.onEnd||Ov,this.onSelect=r.onSelect||Ov,this.onClick=r.onClick||null,this.xs=r.generateLassoContent,this.Ml=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.kr.bind(this),this.upListener=this.pr.bind(this),this.moveListener=this.Hr.bind(this),this.eventManager=new fe,this.Ay(r.filter),this.invert?this.Sy():this.el=yp([NT,r.cssClass||""]),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(yo,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)})}Ay(r){r==null?this.ct=function(){return!1}:X(r)?this.ct=e=>{let t=e.srcElement||e.target;return Gt(t,r)}:this.ct=r}qu(r,e){if(this.visibleOrigin=r,this.size=e,!this.invert)Jt(this.el,r),_r(this.el,e.width,e.height);else{let t=window.innerWidth,n=window.innerHeight,o=window.pageXOffset,s=window.pageYOffset,a=n-r.y+s,l=n-a+e.height,h=t-r.x+o,d=t-h+e.width;this.masks.top.style.bottom=a+"px",this.masks.bottom.style.top=l+"px",this.masks.left.style.right=h+"px",this.masks.right.style.left=d+"px",this.masks.top.style.left=t-h+"px",this.masks.top.style.right=t-d+"px",this.masks.bottom.style.left=t-h+"px",this.masks.bottom.style.right=t-d+"px"}}Nt(r){let e=r?Cr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,gt):this.surface.removeClass(document.body,gt)}Qu(r){return this.Ml==null?r:this.Ml(r)}kr(r){if(this.enabled&&!this.ct(r)){if(le(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.hasMoved=!1,this.origin=this.Qu(ge(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),!this.invert&&this.xs){let e=this.xs(this.origin,r);e!=null?(this.Ku=e,this.el.replaceChildren(e)):this.el.innerHTML=""}this.qu(this.origin,{width:1,height:1}),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r)}}Hr(r){if(this.down){this.moving||(this.Nt(!0),this.moving=!0),le(r);let e=this.Qu(ge(r)),t=this.surface.fromPageLocation(e.x,e.y),n={width:Math.abs(e.x-this.origin.x),height:Math.abs(e.y-this.origin.y)},o={x:Math.min(this.origin.x,e.x),y:Math.min(this.origin.y,e.y)},s={width:Math.abs(t.x-this.canvasOrigin.x),height:Math.abs(t.y-this.canvasOrigin.y)},a={x:Math.min(this.canvasOrigin.x,t.x),y:Math.min(this.canvasOrigin.y,t.y)};s.width>0&&s.height>0&&(this.hasMoved=!0,this.qu(o,n),this.onSelect(o,n,a,s,[this.origin.x<e.x,this.origin.y<e.y],r.shiftKey,this.Ku))}}pr(r){if(this.down){let e=this.moving;this.down=!1,this.moving=!1,le(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Nt(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.xs&&(this.el.innerHTML="")}}Sy(){this.masks.top=yp([nh,MT]),this.masks.bottom=yp([nh,GT]),this.masks.left=yp([nh,IT]),this.masks.right=yp([nh,VT])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Te=class{$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var _v="logarithmic",Rv="absolute";var DL={},Ki={get:i=>{let r=DL[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{DL[i]=r}};var Bf=class Bf{constructor(r){c(this,"type",Bf.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.Pn(r.options)}Pn(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}Nt(r){}};c(Bf,"type","simple");var xp=Bf;Ki.register(xp.type,xp);var NL="vjs-background-tile",Lv=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"Mt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.Mt[s]=this.Mt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.Ty=!0,l.className=NL,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.Mt[s][a]=[l,new Image,!1]}}}vy(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}Cy(r,e,t){return this.urlGenerator==null?this.vy(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Oy(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.Cy(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.Mt[o]!=null&&this.Mt[o][s]!=null&&(this.Mt[o][s][2]||(this.Oy(this.Mt[o][s][0],this.Mt[o][s][1],o,s),this.Mt[o][s][2]=!0))}},Ff=class Ff{constructor(r){c(this,"type",Ff.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"zoomWidget");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"ep");c(this,"rp");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||_v,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.ep=this.debounce(this.np,this.zoomDebounceTimeout),this.rp=this.debounce(this.ip,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new Lv(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Py(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}_y(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}ip(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}np(){this._y(this.Py()),this.ip()}setZoom(r,e){this.widgetZoom=r,e?this.np():this.ep()}pan(){this.rp()}owns(r){return r===this.canvas||r.Ty===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===Rv?this.Ry(r):this.Ly(r)}Ry(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}Ly(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}Nt(r){}};c(Ff,"type","tiled");var bp=Ff;Ki.register(bp.type,bp);var IL=(e=>(e.dotted="dotted",e.lines="lines",e))(IL||{}),E1="dotted",f1="lines",ML={width:50,height:50},VL=2,wv="#ddd",Th="#ddd",y1=2,x1=1,GL="vjs-background",$L="vjs-background-border",Jo="vjs-background-grid",BL="vjs-background-grid-minor",FL="vjs-background-grid-major",Ap="vjs-background-grid-dotted-major",UL="vjs-background-grid-dotted-minor",Uf=class Uf{constructor(r){c(this,"Ye",!1);c(this,"type",Uf.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"He",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"bs");c(this,"Gi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.bs=`p${G().substring(0,8)}`,this.Gi=`p${G().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=B(Pe),this.backgroundContainer.style.position=st,L(this.backgroundContainer,GL),this.Nt(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(It,e=>{this.mr()}),this.ui.bind(er,e=>{this.mr()}),this.ui.bind(md,()=>{this.Ye=!0}),this.ui.bind(xn,()=>{this.Ye=!1,this.mr()}),this.ui.bind($r,e=>{this.mr()}),this.ui.bind(Gr,e=>{this.mr()}),this.ui.model.bind(Re,e=>{this.mr()}),this.ui.model.bind(Ie,e=>{this.mr()}),this.grid=r.options.grid||this.ui.getGrid()||ML,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||VL,this.dotRadius=r.options.dotRadius||y1,this.tickDotRadius=r.options.tickDotRadius||x1,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.mr()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}mr(){this.Ye||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let o=-this.minWidth/2;o<r&&(t+=r-o,r=o);let s=this.minWidth/2;s>r+t&&(t+=s-(r+t))}if(this.minHeight!=null){let o=-this.minHeight/2;o<e&&(n+=e-o,e=o);let s=this.minHeight/2;s>e+n&&(n+=s-(e+n))}if(this.maxWidth!=null){let o=-this.maxWidth/2;o>r&&(t-=o-r,r=o);let s=this.maxWidth/2;s<r+t&&(t-=r+t-s)}if(this.maxHeight!=null){let o=-this.maxHeight/2;o>e&&(n-=o-e,e=o);let s=this.maxHeight/2;s<e+n&&(n-=e+n-s)}this.autoShrink!==!0&&(r=Math.min(r,this.He.minX),e=Math.min(e,this.He.minY),t=Math.max(r+t,this.He.maxX)-r,n=Math.max(e+n,this.He.maxY)-e),we(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.He.minX=Math.min(this.He.minX,r),this.He.minY=Math.min(this.He.minY,e),this.He.maxX=Math.max(this.He.maxX,r+t),this.He.maxY=Math.max(this.He.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}wy(r,e){return`<pattern id="${this.Gi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
-
<path d="M ${r} 0 L 0 0 0 ${e}" class="${
|
|
45
|
-
</pattern>`}
|
|
46
|
-
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${
|
|
47
|
-
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${
|
|
48
|
-
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${Jo} ${Ap}" fill="${Th}" stroke="none"/></pattern>`}My(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.wy(r,e):this.Ny(r,e),n=()=>this.gridType==="lines"?this.Dy():this.Iy();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.My(),e=this.showBorder?`<rect class="${$L}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.bs})" stroke="${pt}"/>`;return r+e+t}Nt(r){this.backgroundContainer.style.display=r?Cr:pt}};c(Uf,"type","grid");var ga=Uf;Ki.register(ga.type,ga);var Ko=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"As",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=Ki.get(n);return this.As=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.As}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.As)}setVisible(e){this.As=e,this.background.Nt(e)}};c(Ko,"type","background"),tn.register(Ko.type,Ko);var vh="c-state",Sp=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===ur?`${vh}-${r}`:`${vh}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${vh}-${this.id}-${a}`:null;l&&Le.addType(s,l,o.data),this.state[ur]&&Le.addType(s,`${vh}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[ur]&&L(l,this.state[ur].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${vh}-${this.id}-${a}`:null;l&&Le.removeType(s,l,o.data),this.state[ur]&&Le.removeType(s,`${vh}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[ur].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[ur]&&F(l,this.state[ur].cssClass)})}};var zf=class{constructor(r){this.ui=r;c(this,"op",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.op[e]=new Sp(e,this.viewOptions.states[e],r)}getState(r){return this.op[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.sp(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.sp(e),t.deactivate(e,this.ui,this.ui.dataSource),wt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}sp(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Ch=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new zf(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Ch,"type","ui-states"),tn.register(Ch.type,Ch);var Dv="direct",b1="orthogonal",Ph=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"ap");c(this,"ne");c(this,"At")}destroy(){}Vy(){let e=this.ui.getLayout();if(e.type!==go.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.ap.forEach(n=>{let o=this.mode===Dv?xA(n):yA(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==Cn){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),g=this.ne[p.source.id],m=this.ne[p.target.id],E=this.At[p.source.id],y=this.At[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),Ve.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-g.x)/E.width,y:(u[0].y-g.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-m.x)/y.width,y:(u[u.length-1].y-m.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||Dv,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||Id,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.ap=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.ne=Object.assign({},n.positions),this.At=Object.assign({},n.sizes),this.Vy()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(bn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(bn,this.layoutListener)}};c(Ph,"type","edgeRouting"),tn.register(Ph.type,Ph);var zL="vjs-selected-edge-highlight",Yf=class Yf extends Te{constructor(){super(...arguments);c(this,"id",Yf.type);c(this,"gr",new Map);c(this,"lp",zL);c(this,"$i");c(this,"S");c(this,"cp",e=>{tt(e.obj)&&(this.Gy(e.obj),this.$y())});c(this,"dp",e=>{tt(e.obj)&&(this.Vl(e.obj.getId()),this.hp())});c(this,"pp",e=>{this.reset()});c(this,"Ss",e=>{e.edge&&this.Bi(e.edge)});c(this,"mp",e=>{e.edge&&this.Bi(e.edge)});c(this,"gp",e=>{e.dragGroup.forEach(t=>this.Ep(t.vertex))})}initialise(e,t){return this.S=e,this.lp=t&&t.className||zL,this.$i=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(ar,this.cp),!0}destroy(){this.reset(),this.S.model.unbind(ar,this.cp)}reset(){this.gr.forEach(e=>{this.S.$removeElement(e)}),this.gr.clear(),this.hp()}$y(){this.S.model.bind(lr,this.dp),this.S.model.bind(vr,this.pp),this.S.model.bind(Zn,this.Ss),this.S.model.bind(Jn,this.mp),this.S.bind(er,this.gp),this.S.bind(Zn,this.Ss)}hp(){this.S.model.unbind(lr,this.dp),this.S.model.unbind(vr,this.pp),this.S.model.unbind(Zn,this.Ss),this.S.model.unbind(Jn,this.mp),this.S.unbind(er,this.gp),this.S.unbind(Zn,this.Ss)}$edgeRemoved(e){this.Vl(e.getId())}$edgeUpdated(e){this.Bi(e)}$vertexUpdated(e,t){this.Ep(e.modelObject)}Ep(e){this.gr.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Bi(o)})}Gy(e){var s;let t=e.getId();if(this.gr.has(t)){this.Bi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=B(Z,{fill:this.$i.fill||"none",stroke:this.$i.stroke||"var(--vjs-color-edit)","stroke-width":this.$i.strokeWidth||2,"stroke-dasharray":this.$i.dashArray,"pointer-events":"none",rx:2},{},this.lp);this.fp(o,n),this.S.$appendElementToToolsLayer(o),this.gr.set(t,o)}Bi(e){var s;let t=e.getId(),n=this.gr.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.Vl(t);return}this.fp(n,o)}Vl(e){let t=this.gr.get(e);t&&(this.S.$removeElement(t),this.gr.delete(e))}fp(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ce(e,{x:s,y:a,width:o.width,height:o.height})}};c(Yf,"type","selected-edge-highlight");var ma=Yf;tn.register(ma.type,ma);var Vn=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",hi);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[])}destroy(){}initialise(e,t){return e.bind(An,n=>{this.lasso.enabled=n===hi}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new pa({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,onStart:(n,o,s,a)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,this.onStart&&this.onStart()},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0]}),g=p.length,m={};for(u=0;u<g;u++)p[u].v.group==null&&(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),m[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,g=d.length,t.includeEdges){let E={};for(u=0;u<g;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===he.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===he.objectType?y[f].target.getParent().id:y[f].target.id;m[b]&&m[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d)},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==Zo&&e.setMode(yr),e.fireUnchecked(Bb),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c(Vn,"type","lasso"),Vn=Ze([ke("lasso")],Vn);var YL="vjs-surface-elastic-group-resize",Xf="elasticGroupFrame:resize",jf="elasticGroupFrame:remove",Ea=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"By");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),Rt(this.uiGroupContentArea)?this.frame=B(Z):(this.frame=B(Pe),this.frame.appendChild(B(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,YL),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=Ug(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=Ug(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.Fy(),this.By=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Fy(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.Uy(e,t)}Uy(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=vu(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,_r(this.frame,this.width,this.height),we(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(Xf,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(jf,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}Gl(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.Gl(r,e),{movedElements:r,resizedGroups:e}}};var XL="resize";function Hf(i,r,e){let t={width:i.width,height:i.height,position:i.position||st},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=Qs(i.ns,i.type||We,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var kf="vjs-node-id",Nv="vjs-miniview-type",jL="miniview",Gn=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"uiBounds");c(this,"suspended");c(this,"$l");c(this,"typeFunction");c(this,"Er");c(this,"Ts");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"clickToCenter");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"Bl");c(this,"uiBindings",[]);c(this,"Fl");c(this,"viewport");c(this,"Dt");c(this,"kr");c(this,"Hr");c(this,"pr");c(this,"Ul")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,pe,this.kr),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.eventManager.off(window,XL,this.Ul),F(this.containerElement,Xu),F(this.containerElement,ju),this.$l&&(this.eventManager.off(this.Er,Fe,this.Fl),this.Er.parentNode.removeChild(this.Er)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Ir,this.Bl),this.Dt&&Zl(this.containerElement,this.Dt),this.panzoom=null}zy(e){}Yy(e){}Ee(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.clickToCenter=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.kr=this.downListener.bind(this),this.Hr=this.moveListener.bind(this),this.pr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Hf({position:st,width:On,height:On,left:0,top:0,clazz:BT},this.containerElement),this.canvasElement=Hf({position:aS,width:On,height:On,left:0,top:0,clazz:$T},this.containerElement),this.suspended=t.suspended===!0,this.$l=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.Er=null,this.Ts=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new fe,L(this.containerElement,Xu),this.Fl=this.toggleCollapsed.bind(this),this.$l&&(this.Er=Hf({type:"div"}),this.Er.className=zT,this.containerElement.appendChild(this.Er),this.ui.on(this.Er,Fe,this.Fl)),this.viewport=this.ui.viewport,this.panzoom=new ha({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>we(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.j(o),events:{pan:()=>{this.yp()},mousedown:()=>{L(this.pannerElement,bf)},mouseup:()=>{F(this.pannerElement,bf)}},zoomRange:[-1/0,1/0]}),this.Ul=ea(()=>{this.Ge()},100),this.eventManager.on(window,XL,this.Ul),this.enableWheelZoom!==!1&&(this.Dt=this.wheelZoom.bind(this),Wl(this.containerElement,this.Dt)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,Xu),this.eventManager.on(this.pannerElement,pe,this.kr),this.Bl=()=>{this.Ge(),this.ot(!0),setTimeout(()=>{this.Ge(),this.ot(!0)},0)},this.Ee(xn,this.Bl),this.setVisible(this.visible),this.Ee(fl,this.Ge),this.Ee(Kn,this.Ge),this.Ee(It,this.vs),this.Ee(er,o=>{this.activeTracking&&this.vs(o)}),this.Ee($r,this.zl),this.Ee(ml,this.Xy),this.Ee(bn,this.jy),this.Ee(Gr,this.xp),this.Ee(Vr,this.vs),this.Ee(Zc,o=>{this.activeTracking&&this.vs(o)});let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&Jt(l,a)}this.ot(!0)};return this.Ee(bn,n),this.Ee(Ds,n),this.Ee(yb,this._n),this.Ee(Ed,this.ky),this.Ee(Xf,this.zy),this.Ee(jf,this.Yy),this.Hy(),this.clickToCenter&&(L(this.containerElement,YT),this.eventManager.on(this.canvasElement,W,be(kf),o=>{let s=o.target.getAttribute(kf);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.Wy(),this.panzoom.setZoom(1),this.panzoom.reset(),this.Ge()}bp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=Dt(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}Hy(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.xp({el:s,id:n[o].id,vertex:n[o],pos:this.bp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.zl({el:s,id:t[o].id,vertex:t[o],pos:this.bp(t[o])})}(n.length>0||t.length>0)&&this.ot(!0)}xp(e){this.zl(e,UT)}$groupCollapsed(e){this.Ap(e.modelObject,!1),this._n({id:e.id})}$groupExpanded(e){this.Ap(e.modelObject,!0),this._n({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&_r(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Cs(e),this.ot(!0))}downListener(e){this.panning=!0,this.downAt=ge(e),this.pannerAtMouseDown=sn(this.pannerElement),this.eventManager.on(document,se,this.pr),this.eventManager.on(document,oe,this.Hr),le(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=ge(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.yp(s),Jt(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,se,this.pr),this.eventManager.off(document,oe,this.Hr)}wheelZoom(e){le(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Ts=!this.Ts,this.Ts?L(this.containerElement,ju):F(this.containerElement,ju),this.ot(!0)}ot(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.Ge,doNotFirePanEvent:e})}vs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Cs(t.element)}),this.ot(!0)}Xy(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);Jt(s,{x:a.x-e.element.x,y:a.y-e.element.y}),_r(s,a.width,a.height)}});let n=Dt(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}Jt(t,n),_r(t,e.element.width,e.element.height),this.Ge()}jy(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&Jt(o,n)}this.ot(!0)}Zy(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}zl(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Hf({position:st,width:a.width+Pn,height:a.height+Pn,left:s.x,top:s.y,clazz:FT+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(Nv,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(kf,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}z(e.vertex)&&this.Zy(e.vertex,l),this.ui.$_dataLoading||(this.ot(!0),this.Ge())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Cr:pt}getPan(){return this.panzoom.getPan()}Ap(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}_n(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+Pn,t.style.height=n.height+Pn,this.Ge(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(Nv,this.typeFunction(o))}}}invalidate(e){if(e)this._n({id:e});else for(let t in this.vertexMap)this._n({id:t})}setSuspended(e,t){this.suspended=e,t&&this.Ge()}Sp(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.ot(!0)),t||this.Ge()}$nodeRemoved(e){this.Sp(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.Sp(e,!1)}$groupResized(e){this._n({id:e.element.id,size:e.newGroupSize}),this.ot(!0)}Cs(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);Jt(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.Cs(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.Cs(e))}}Wy(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.Ge()}ky(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}Ge(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+Pn,this.pannerElement.style.height=this.uiBounds.vh+Pn,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},Jt(this.pannerElement,this.pannerPos)}}yp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||sn(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(Gn,"type",jL),Gn=Ze([ke(jL)],Gn);var Iv="vjs-pan-mode",Mv="vjs-zoom-to-fit",Vv="vjs-zoom-in",Gv="vjs-zoom-out",Wf="vjs-select-mode",$v="vjs-undo",Bv="vjs-redo",Fv="vjs-clear-dataset",A1="vjs-selected-mode",Tp="vjs-controls",Uv="vjs-export-controls",zv="vjs-controls-reset-selection",S1="vjs-copy-paste-controls";var Yv=class{constructor(r){c(this,"ui");this.ui=r.ui}};var T1="Clear dataset?",Xv="vjs-selected-mode",HL="vjs-controls-has-selection",kL="can-undo",WL="can-redo",ZL="data-undo",JL="data-redo",fa="data-mode",KL="data-reset",qL="data-clear",QL="data-zoom-in",e0="data-zoom-out",jv="data-reset-selection",t0="data-vjs-orientation",r0="0 0 32 30",n0="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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",i0="0 0 24 24",o0="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",s0="0 0 24 24",a0="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",l0="0 0 24 24",h0="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",c0="0 0 24 24",d0="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",u0="0 0 24 24",p0="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",Hv="0 0 32 32",g0="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",m0="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function v1(){return`<i class="${Iv}" ${Xv} ${fa}="${yr}" title="Pan Mode">
|
|
49
|
-
<svg:svg viewBox="${
|
|
50
|
-
</i>`}function
|
|
51
|
-
<svg:svg viewBox="${
|
|
52
|
-
</i>`}function
|
|
53
|
-
<svg:svg viewBox="${
|
|
54
|
-
<svg:path d="${
|
|
43
|
+
</g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var oa=class extends _c{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var ap=class extends oa{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var lp=class extends oa{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||K(e))&&e.group==this.group}};var hp=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?Ge.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var cp=class extends Yd{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new hp(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function ui(i){return jr(i)&&i.useHTMLElement!==!0}function Jo(i){return i.isSimpleShape}function x1(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function b1(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function sa(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=eh.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return Ho(r,i),i.textElement}function bh(i,r){return eh.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var aa=class extends Lu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"V");c(this,"pl");c(this,"Lu");c(this,"Rn");c(this,"lr");c(this,"Ge");c(this,"hr");c(this,"wu");c(this,"fe");c(this,"ml");c(this,"Du",new Set([Nl,Mo,Vo,lu,Yi,hu,zo]));c(this,"nt",null);c(this,"Fi",[]);if(o=o||{},a=a||{},this.fe=new fe,this.clipboard=new cp(this),this.V=s,this.containerType=Yu(this.getContainer()),this.wu=a.hoverEvents!==!1,this.hr=Hl,this.pl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.Lu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.ml=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Vu(this,{edgeMappings:o.edges.propertyMappings})),this.Rn=[],this.Nu(),this.on(n,"animationend",z(zi,Go),h=>{let d=h.target;d.style.animation=null,F(d,Sf)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ge=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,mt);if(p!=null){let m={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},g=this.viewport.getElement(p);g!=null&&(g.width!==m.width||g.height!==m.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new ia(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||pv,h),this.Of(),this._f()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((K(e.modelObject)||Y(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(Rt(n.parentElement)){let s=De(e,e.c,e.r);o(s),an(n,s),di(n,e.r)}else{di(n,e.r);let s=Nt(e);o(s),we(n,s)}t&&(this.$repaintUIElement(e),this.ie(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.Du.add(t))}$enableVertexDrag(){this.lr.$enable()}$disableVertexDrag(){this.lr.$disable()}$canDrop(e,t,n){return this.ml!=null?this.ml(e,t,n):!0}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.V.usesWrapperElement&&t.firstElementChild!=null&&this.Du.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new ap(this)}$createGroupLayoutAdapter(e){return new lp(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}Of(){this.nt=this.getShapeLibrary().getSvgDefsElement(),this.nt.style.position="absolute",this.nt.style.width="1px",this.nt.style.height="1px",this.nt.style.left="-10000px",this.nt.style.top="-10000px",this.getContainer().appendChild(this.nt)}_f(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===ie.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}Rf(e,t,n){let s=["edge",t].join(":");if(n.Lf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.Bi(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.V.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Cr:pt}$doVertexUpdated(e){this.V.reactive===!1&&this.V.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.V.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.Ee,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.Ee,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(Hl);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return AT(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return sn(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){mf(e,t)}$updateElementClasses(e,t,n){Ft(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.fe.on(a,t,n):this.fe.on(a,t,n,o)};return Dn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Dn(e)?e.forEach(o=>this.fe.off(o,t,n)):this.fe.off(e,t,n),this}trigger(e,t,n,o,s){this.fe.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return ki(e)}wf(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=ln(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=Hu(n,this.getContainer(),!0);if(H(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=Hu(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=De(h,l,a.r);return De(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=De(a,s,e.r);return De(s,l,-e.r)}return s}else{if(n.namespaceURI===Vt){let l=n.closest(Pe);l!=null&&l!==n&&(o=Hu(n,l,!0),n=l)}let s=this.getContainer(),a=ln(n,t);if(this.wf(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,uf):AS,h=this.$getStyle(n,uf);h!==Ke&&h!==CE&&l!==Ke&&l!==CE&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){Or(e,t,n)}$setElementWidth(e,t){UT(e,t)}$setElementHeight(e,t){YT(e,t)}$getSize(e){return et(e)}$setElementRotation(e,t){di(e,t)}$setVisibleElementRotation(e,t){di(e.el,t),this.ie(n=>n.$vertexRotated(e,t))}$getElementPositionInUIRelativeToParent(e){return ln(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==Zx?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,fT);return t&&t.length>0?t[0]:this.V.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return ST.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?Rt(e.el.parentElement)?zT(e,t):we(e.el,t):we(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,Nl):this.$setAttribute(n.el,Nl,vt))}isDraggable(e){let t=this.$getAttribute(e,Nl);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}Bi(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||VE}fs(e,t){let o=Bt(Xo(t),wn,this.getContainer(),!0).jtk.overlay;o&&this.Rf(o,e,t)}Df(e){this.fs(Ye,e)}Nf(e){this.fs(xo,e)}If(e){this.fs(W,e)}Mf(e){this.fs(Br,e)}ys(e,t,n){if(!n.defaultPrevented&&n.Lf==null){let o=Bt(Xo(n),kr,this.getContainer(),!0);this.Bi(e,t,o.jtk.connection,n,null)}}Vf(e){this.ys(Ye,Wb,e)}Gf(e){this.ys(xo,Zb,e)}$f(e){this.ys(W,Qb,e)}Bf(e){this.ys(Br,Jb,e)}Iu(e,t){let o=Bt(Xo(t),wn,this.getContainer(),!0).jtk.overlay;o&&this.Mu(o.connection,e,t)}Ff(e){this.Iu(!0,e)}Uf(e){this.Iu(!1,e)}Mu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(qe)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(qe)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(qe)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Ft(e.sourceElement,[wf]),Ft(e.targetElement,[Df])):(Ft(e.sourceElement,[],[wf]),Ft(e.targetElement,[],[Df]));let a=t?st:ot,l=t?Ad:bd;this.Bi(a,l,e,n,null)}}Vu(e,t){var o;let n=Xo(t).parentNode;this.Mu((o=n.jtk)==null?void 0:o.connection,e,t)}zf(e){this.Vu(!0,e)}Yf(e){this.Vu(!1,e)}Gu(e,t){let n=Xo(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(Zi)&&!o.classList.contains(Ji)){let s=e?se:pe,a=e?Kb:yl;this.Bi(s,a,n.jtk.connection,t,null)}}}Xf(e){this.Gu(!0,e)}jf(e){this.Gu(!1,e)}Hf(e){let t=Xo(e).parentNode;t.jtk&&t.jtk.connection&&this.Bi(bt,qb,t.jtk.connection,e,null)}kf(e){let t=this.getModelObjectFromElement(e.target,!0,!1);if(t!=null)return{el:t.el,obj:t.obj,e,model:this.model,ui:this}}dr(e,t,n){if(!e.defaultPrevented){let o=this.kf(e);if(o!=null){let s=K(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):H(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Wf(e){this.dr(e,Ye,Fb)}Zf(e){this.dr(e,xo,Ub)}Jf(e){this.dr(e,W,kb)}Kf(e){this.dr(e,Br,Yb)}qf(e){this.dr(e,bt,Hb)}Qf(e){this.dr(e,ot,zb)}ey(e){this.dr(e,st,Xb)}ny(e){this.dr(e,oe,jb)}iy(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}ly(e,t,n){let o=n.bind(this);this.Rn.push({eventName:e,handler:o}),this.fe.on(this.getContainer(),e,t,o)}addDragHandler(e){this.lr==null?this.Fi.push(e):this.lr.addHandler(e)}hy(){this.lr!=null&&this.lr.destroy(),this.Fi=this.Fi||[],this.lr=new If(this.Ee,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.$u(e)}),this.Fi.forEach(e=>this.lr.addHandler(e)),this.Fi.length=0}$u(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=ae(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.xs(le.objectType,this.getContainer())}$getGroupsInViewport(){return this.xs(ie.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return Ln()}$isArrayLike(e){return super.$isArrayLike(e)||Dn(e)}xs(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),tt(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}Nu(){if(this.Rn!=null){this.gl();let e=[[Ye,wn,this.Df],[xo,wn,this.Nf],[W,wn,this.If],[Br,wn,this.Mf],[Ye,kr,this.Vf],[xo,kr,this.Gf],[W,kr,this.$f],[Br,kr,this.Bf],[Ye,this.hr,this.Wf],[xo,this.hr,this.Zf],[W,this.hr,this.Jf],[Br,this.hr,this.Kf],[W,yT,this.iy],[bt,kr,this.Hf],[se,kr,this.Xf],[pe,kr,this.jf],[bt,Hl,this.qf]];this.wu===!0&&e.push.apply(e,[[st,kr,this.zf],[ot,kr,this.Yf],[st,wn,this.Ff],[ot,wn,this.Uf],[ot,this.hr,this.Qf],[st,this.hr,this.ey],[oe,this.hr,this.ny]]),e.forEach(t=>{this.ly(t[0],t[1],t[2])})}}gl(){let e=this.getContainer();e&&this.Rn!=null&&(this.Rn.forEach(t=>{this.fe.off(e,t.eventName,t.handler)}),this.Rn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.gl(),this.$setAttribute(e,cf,$().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(cf),Array.from(t.childNodes).filter(o=>o!=null&&(sn(o,Zs)||sn(o,Js)||o.getAttribute&&o.getAttribute(mt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Yu(e),this.fe!=null&&(this.hy(),this.Nu())}reset(){super.reset(),this.Ge&&this.Ge.disconnect(),this.getContainer().querySelectorAll([Hl,kr,wn].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.nt!=null&&this.nt.parentNode!=null&&this.nt.parentNode.removeChild(this.nt),this.gl(),super.destroy()}$__unmanage(e,t,n){this.Ge!=null&&this.Ge.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(Jo(e))th(this,e).map(n=>L(n,t));else if(ui(e))Ho(this,e).map(n=>L(n,t));else if(jr(e))L(sa(e,this),t);else if(on(e))L(bh(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(Jo(e))th(this,e).map(n=>F(n,t));else if(ui(e))Ho(this,e).map(n=>F(n,t));else if(jr(e))F(sa(e,this),t);else if(on(e))F(bh(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.El(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.El(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.El(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(H(e))return this.getPortDefinition(e);if(K(e))return this.getNodeDefinition(e)}El(e){return e!=null&&e.template&&e.templateId==null&&this.V.addTemplate&&(e.templateId=$(),this.V.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.V.recado!=null&&this.V.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),m=a,g;m=Object.assign({},l?l.parameters||{}:{}),Object.assign(m,a);let E={};for(g in m)m.hasOwnProperty(g)&&m[g]!=null&&(m[g].constructor==Function?E[g]=m[g](a):E[g]=m[g]);if(m=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(m,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);m[this.$modelWidthAttribute]=x.width,m[this.$modelHeightAttribute]=x.height}d?this.V.rerender(y,m,this.model,e,this,l,s,h,u):this.V.render(y,m,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.pl(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.pl(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Lu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(Jo(e))VT(this,e,t,n);else if(ui(e))GT(this,e,t,n);else if(jr(e)){sa(e,this);let o=t,s=e;this.Bu(s,o,e.rotatable!=null)}else if(on(e)){bh(e,this);let o=t,s=e;this.Bu(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}Bu(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+On,e.contentElement.style.top=t.d.miny+On,n&&di(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,Vl):L(o,Vl))}if(Jo(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else ui(e)?e.contentElements&&e.contentElements.forEach(n):jr(e)?n(sa(e,this)):on(e)&&n(bh(e,this))}$reattachOverlay(e,t){Jo(e)?th(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):ui(e)?Ho(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):jr(e)?this.$appendElement(sa(e,this),this.getContainer()):on(e)&&this.$appendElement(bh(e,this),this.getContainer())}$setOverlayHover(e,t){let n;Jo(e)?n=th(this,e):ui(e)?n=Ho(this,e):jr(e)?n=[sa(e,this)]:on(e)&&(n=[bh(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Ft(o,t?[hh]:[],t?[]:[hh])}),this.$setHover(e.connection,t))}destroyOverlay(e){Jo(e)&&e instanceof ju?Ef(e):ui(e)?Ef(e):IT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):on(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(Jo(e))return e.draw(t,n,o);if(ui(e)){let s=ur(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(X(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let m=ur(t,u,p),g=$e(t,u,.01,p);d=qa(Ka(m,g)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=qa(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(jr(e)||on(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=ur(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=ur(t,d,u),m=$e(t,d,.01,u);h=qa(Ka(p,m)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=qa(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=sa(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){uv(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&Ft(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Ft(o,t?[hh]:[],t?[]:[hh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.ss===ji&&this.setOverlayVisible(s,t)}),this.mt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&b1(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){x1(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&this.V.cleanupVertex(e.node.id,t.el),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.V.cleanupVertex(e.group.id,t.el),t}addClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.fl(e,t,L)}removeClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.fl(e,t,F)}toggleClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.fl(e,t,mf)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?sn(n.el,t):Wi(e)?sn(e,t):!1}}fl(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):Wi(s)&&n(s,t)};e!=null&&(Dn(e)?n(e,t):bT(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){qt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Rt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ge!=null&&this.Ge.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Bt(e,be(rn),this.getContainer(),!0)||Bt(e,be(te),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!rt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=H(l)?l.getParent():l,m={},g=t?Ui:Yi;if(o=e.getAttribute(g)||e.getAttribute(Xr),!H(l)){let E=t?[Ws,OE]:[Vo,lu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(rn)||e.getAttribute(Il),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return H(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?m=this.view.getPortDefinition(o):m=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:m,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return Wi(e)}getElementFromEvent(e){let t=Bt(e.target,be(mt),this.getContainer(),!0);return t!=null?this.getElement(t.getAttribute(mt)):null}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(te);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(rn)||s.getAttribute(Ws)||s.getAttribute(Vo);if(h!=null){let d=Bt(s,be(mt),this.Ee,!1);if(d!=null){let u=d.getAttribute(mt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let m=s.getAttribute(Xr)||s.getAttribute(Ui)||s.getAttribute(Yi)||xe;return{obj:p.$addPort({id:h,type:m}),el:s,missingPortCreated:!0}}else{let m=p.getPort(h);return m==null?null:{obj:m,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.Ee?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(H(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(hi(rn,n[1]))||o.querySelector(hi(Vo,n[1]))||o.querySelector(hi(Ws,n[1]))||o:null}$isSupportedElement(e){return Wi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=G(Pe,a,o,s);return Or(l,t.width,t.height),this.containerType==="SVG"?an(l,e):we(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(X(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(rn,n[1])||s(Ws,n[1])||s(Vo,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(rn)===n[1]||o.getAttribute(Ws)===n[1]||o.getAttribute(Vo)===n[1]||o.getAttribute(Il)===n[1]||o.getAttribute(OE)===n[1]||o.getAttribute(lu)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),m=Math.max(d,Math.abs(n.y-t.y)),g=G(Pe,{viewBox:`0 0 ${p} ${m}`});g.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:m,x=t.x>n.x?0:p,f=t.y>n.y?0:m,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:m},type:Pn,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(R,v,_)=>{let[P,I]=X(R)?[R,{}]:[R.type,R.options],C=uo(I,l,"_");C.location=v,C.direction=_;let O=at.get(this,P,{instance:this},C),w=this.$drawOverlay(O,A,{stroke:u,fill:u});if(O.isSimpleShape){let B=O,N=w;B.contentTags.forEach((M,D)=>{let V=G(M,N.atts[D]);g.appendChild(V)})}else if(ui(O)){let B=O,N=w;B.contentElements.forEach(M=>{an(M,N.d.loc),g.appendChild(M)})}else if(on(O)){let B=O,N=w;B.contentElements.forEach(M=>{an(M,N.d.loc),g.appendChild(M)})}return w};if(s!=null){let R=T(s,0,-1);E=R.tail.x,y=R.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let R=T(a,1,1);x=R.tail.x,f=R.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=G(ee,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return g.appendChild(S),o.forEach(R=>{let[v,_]=X(R)?[R,{}]:[R.type,R.options],P=uo(_,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let O=I,w=C;O.contentTags.forEach((B,N)=>{let M=G(B,w.atts[N]);g.appendChild(M)})}else if(ui(I)){let O=I,w=C;O.contentElements.forEach(B=>{an(B,w.d.loc),g.appendChild(B)})}else if(jr(I))if(I.useHTMLElement){let O=C,w=I.contentElement;h.appendChild(w),w.style.left=`${O.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${O.d.cxy.y}px)`}else{let O=G(ee,C.atts[0]);g.appendChild(O)}else if(on(I)){let O=C,w=I.create(null,null,this,this.model);w.style.position=Ke,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${O.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${O.d.cxy.y}px)`}}),h.appendChild(g),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Rt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&Wi(o)&&(t?o.removeAttribute(gr):o.setAttribute(gr,ct)),t}flashVertex(e,t=1e3,n=kT){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,Sf))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof cr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var la=`<div data-vjs-vertex="{{id}}" class="${zi} ${Of}">{{label}}</div>`,N0="<div/>",I0=`<div data-vjs-vertex="{{id}}" class="${Go} ${Rf}">{{label}}</div>`,ha=`<svg:rect data-vjs-vertex="{{id}}" class="${zi} ${Of}" x="0" y="0" width="80" height="60"/>`,M0='<svg:rect x="0" y="0" width="100%" height="30"/>',V0=`<svg:rect data-vjs-vertex="{{id}}" class="${Go} ${Rf}" x="0" y="0" width="300" height="250"/>`,A1={html:{"vjs-node-default":la,"vjs-group-default":I0,"vjs-port-default":N0},svg:{"vjs-node-default":ha,"vjs-group-default":V0,"vjs-port-default":M0}},Pv=(i,r)=>A1[i][r],dp=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=yr({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.le(h),this.render(r,e,t,n,o,s,a,l)}le(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.le(e)}cleanupPort(r,e){this.le(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.le(r)}};function Ah(i,r,e){let t=n=>Pv(r?"svg":"html",n)||Mf(n)||i;return new dp(i,t,e)}var S1="pointerdown",T1="pointermove",v1="pointerup",C1="touchstart",G0="touchmove",$0="touchend";function B0(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var up=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=B0(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.Ur(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.Fu())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Ur(this.onPinch))};this.bind(r.el,S1,a,{passive:!1}),this.bind(document,v1,l,{passive:!1}),this.bind(document,T1,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return B0(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,G0,h),this.bind(document,$0,l),he(d),this.Ur(this.onPinchStart))},l=d=>{s=!1,he(d),this.unbind(document,G0,h),this.unbind(document,$0,l),this.Fu()},h=d=>{if(s){let u=e(d);u.length===2&&(he(d),this.radius=n(u),this.center=o(u),this.Ur(this.onPinch))}};this.bind(r.el,C1,a)}});this.eventManager=new fe,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}Ur(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}Fu(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var pp=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}uy(r,e){if(e===Q){let t=r.pos[e];if(r.alignX===ft){let n=et(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=et(r.el);return t-n.height}return t}}yl(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.uy(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(je,"x",(a,l)=>{BT(a,l),o.currentPosition.x=l}),s(Se,"y",(a,l)=>{FT(a,l),o.currentPosition.y=l})}}pan(){this.yl()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Rt(this.panZoom.canvasElement)&&!Rt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||je,alignY:t.alignY||Se,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Rt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this.yl(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this.yl())}destroy(){this.panZoom=null,this.fixedElements=null}};var P1="transformOrigin",F0="transform",_1="translateX",O1="translateY",R1="scale",U0="px",z0="vjs-pan-zoom",X0="vjs-pan-zoom-canvas";function ca(){}function Y0(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var da=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"Uu");c(this,"Gt");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"xl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"Al");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Zr");c(this,"Ln");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"Sl");c(this,"Tl");c(this,"Ui");c(this,"vl");c(this,"Cl");c(this,"viewport");c(this,"bs");c(this,"Ge");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"zi",{});c(this,"Pl",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.Sy===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=me(r),this.Zr=this.$_getViewportSize(),this.ur(),this.ku(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.Ay(r)&&(this.Zr=this.$_getViewportSize(),this.ur(),this.panning=!0,this.aboutToPan=!0,this.downAt=me(r),this.canvasAtPanStart=Object.assign({},this.position),he(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=me(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.wl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){he(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=me(r),t=(o.x-this.downAt.x)/this.bs,n=(o.y-this.downAt.y)/this.bs;let s=this.it({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),he(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Zr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,oe,this.Sl),this.eventManager.off(document,se,this.Tl),this.eventManager.on(document,oe,this.Ui),this.onMouseUp(r,this))},[bt]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||GS,this.xl=r.zoomStep||.25,this.fixedLayer=new pp(this,r.elementPositionSetter),this.eventManager=new fe,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ge=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.ur()})}),this.Ge.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.it({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,z0),L(this.canvasElement,X0),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||ca,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||ca,this.onPanStart=r.events.panStart||ca,this.onMouseDown=r.events.mousedown||ca,this.onMouseUp=r.events.mouseup||ca,this.onMouseMove=r.events.mousemove||ca,this.onSetTransformOrigin=r.events.transformOrigin||ca,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.Al=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let e=r.wheel||{};this.enableWheelZoom=e.zoom!==!1,this.wheelFilter=e.filter||(()=>!0),this.wheelCssFilterSpec=e.cssFilter,this.wheelZoomRequiresMetaKey=e.useMetaKey===!0,this.wheelDirection=e.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(e.sensitivity||10),this.wheelPan=e.pan===!0,this.wheelPanAxis=e.axis||"both",this.zu(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.Sl=function(t){this.Ol("move",t)}.bind(this),this.Tl=function(t){this.Ol("end",t)}.bind(this),this.Ui=function(t){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Gt=(t,n,o,s)=>this.wheelPanOrZoom(t,n,o,s),Jl(this.viewportElement,this.Gt,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new up({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(t,n,o,s)=>{this.J(s*this.zoomAtZoomStart);let a=t.x-this.downAt.x,l=t.y-this.downAt.y;this.it({x:this.canvasAtPanStart.x+a,y:this.canvasAtPanStart.y+l,animate:!1})},onPinchStart:(t,n)=>{this.pinchZooming=!0,this.downAt=t,this.distanceAtZoomStart=this.lastDistance=n,this.zoomAtZoomStart=this.zoom,this._l(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.J(this.zoom,null,!1,!1,!0),this.Rl(),this.background=new _v,r.background&&this.background.addBackground(r.background),this.vl=t=>{this.start(t)},this.eventManager.on(this.viewportElement,pe,this.vl),this.eventManager.on(document,oe,this.Ui),this.Cl=t=>{this.Ol(bt,t)},this.eventManager.on(this.viewportElement,bt,this.Cl),this.ur(),this.$computeCompoundZoom()}getCompoundZoom(){return this.bs}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.zu())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.bs=e.width/r.width}$_getViewportSize(){return this.Zr=et(this.viewportElement),this.Zr}ur(){return this.Ln=et(this.canvasElement),this.Ln}zu(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!$t(e,this.wheelCssFilterSpec)})}py(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=m=>{u||(u=m);let g=m-u,E=g/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,g<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}it(r){let e=this.Yu(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.Xu(r.zoom);this.py(t,e.x,e.y,r.animationDuration)}else this.position=e,this.ju(null,r.onComplete);else this.position=e,this.Ll(),r.onComplete&&r.onComplete(this.position);return this.position}Hu(r,e,t,n,o){let s=this.position;return this.it({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}my(r,e,t,n){n||this.pan(-e*100,-t*100)}gy(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.ku(r),this.zoomingWithWheel=!0),this.wl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.gy(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===Q?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===Ee?t:0,this.my(r,e,t,n)))}Ey(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}Wu(){return`${R1}(${this.zoom}) ${_1}(${this.position.x/this.zoom}${U0}) ${O1}(${this.position.y/this.zoom}${U0})`}Ll(){this.canvasElement.style[F0]=this.Wu()}ju(r,e){if(this.canvasElement.animate!=null){let t={[F0]:this.Wu()};this.Ey(t,r,e)}else this.Ll()}fy(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}Rl(){this.canvasElement.style[P1]=this.fy()}yy(r,e){let t=this.fromPageLocation(r,e),n=this.Ln||this.ur();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}Zu(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.Rl(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.Hu(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}_l(r,e){if(this.fixedTransformOrigin==null){let t=this.yy(r,e);this.Zu(t.o,t.width,t.height)}}ku(r){if(this.fixedTransformOrigin==null){let e=me(r);this._l(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.Ln||this.ur();this.Zu({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}Xu(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}J(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.Xu(r);let s=this.zoom,a=l=>{if(!this.Pl&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.Yu(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.it({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.ju(null,a)}else this.zoom=r,this.Ll(),a(this.position);return this.zoom}wl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.by(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}by(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.J(h,o,s)}Yu(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Zr||this.$_getViewportSize(),o=this.gt(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let g=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,g),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,m=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),m>l.vh&&(a-=m-l.vh),{x:s,y:a}}}gt(){let r=this.Ln||this.ur(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}Ay(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.Al!=null?this.Al(e)!==!1:!0}Ol(r,e){r===bt&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Yo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,oe,this.Ui),this.eventManager.on(document,oe,this.Sl),this.eventManager.on(document,se,this.Tl),this.handlers.start(r,Yo(r)))}getBoundsInfo(r,e){let t=this.Zr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.zi[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.zi[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.zi[e]}remove(r){let e=this.idFunction(r);delete this.zi[e]}reset(){this.zi={},this.it({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.J(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.J(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.J(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.J(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||je,o=t[1]||Se,s=this.getBoundsInfo(),a=n===je?0:s.vw-this.background.getWidth()*this.zoom,l=o===Se?0:s.vh-this.background.getHeight()*this.zoom,h=this.gt();this.it({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=ki(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this._l(o,s),this.J(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.wl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.Ln||this.ur(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.gt(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,m=this.position.x,g=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?g:r.alignY===ht?y:r.alignY===It?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?m:r.alignX===ft?b:r.alignX===It?d-a.x:f*this.zoom;this.it({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.Pl||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Se,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=je,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=ft,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:It,r.alignY=r.vertical===!1?null:It,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.gt(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.gt(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.it({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.J(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.J(this.zoom+this.xl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.J(this.zoom-this.xl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.J(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.Hu(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.it({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this.Uu=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.Uu)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.Rl()}fromPageLocation(r,e,t){let n=this.gt(),o=this.position,s=Y0(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.gt(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.gt(),n=this.position,o=Y0(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}mapEventLocation(r){let e=me(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}getApparentCanvasLocation(){let r=this.gt(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.gt(),n=this.it({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ge!=null&&(this.Ge.disconnect(),this.Ge=null),this.Gt!=null&&Kl(this.viewportElement,this.Gt),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,oe,this.Ui),this.eventManager.off(this.viewportElement,pe,this.vl),this.eventManager.off(this.viewportElement,bt,this.Cl),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.Pl=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},_v=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}$t(r){this.backgrounds.forEach(e=>e.$t(r))}};function DTe(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),m=o+(e-o)*p;i.setZoom(m);let g={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(g.x,g.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var Ov={},mp=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=ln(s.el),l=et(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},Sh=class extends mp{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function L1(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new Sh(s,e,t,n,o,s.incremental)}}var gp={get:(i,r,e,t,n)=>{let o=Ov[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{_x(r,mp)?Ov[i]=r:Ov[i]=L1(r)}};function Rv(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=$()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||$()),s!=null&&a!=null)l=gp.get(s,a,r,e,h);else{let u=o;h=u.id||$(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new Sh(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var Ff=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{Hr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{Pr(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var Lv="default",w1="center",j0="perimeter",Ep=hi(vS,vt),H0=hi(Mo,vt);function k0(i){return W0(i,H0)}function W0(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function fp(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function yp(i,r,e,t,n){let o=null,s=i.getEffectiveVisibleZoom(),a={x:e.x-s*((n==null?void 0:n.x)||0),y:e.y-s*((n==null?void 0:n.y)||0),width:e.width,height:e.height};for(let l=0;l<r.length;l++)if(tt(a,r[l].r)){o=r[l];let h=r[l].modelInfo.typeDef,d=r[l].modelInfo.objEl,u=zu(t,d,s);r[l].positionOnElement=u,h.anchorPositionFinder!=null?r[l].anchor=h.anchorPositionFinder(d,u,o.modelInfo.vertex,h):r[l].anchor=null;break}return o}function D1(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function Th(i,r,e,t,n,o){return wv(i,r,e,!1,t,n,o)}function Dv(i,r,e,t,n,o){return wv(i,r,e,!0,t,n,o)}function wv(i,r,e,t,n,o,s){let a=[],l=[];return k0(i).forEach(d=>{if(d.getAttribute(gr)!==ct){if(s!=null&&d.getAttribute(zo)!==s)return;let u=fp(i,d,!1);if(!n&&u.obj===e)return;if(D1(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:Y(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(Xr)||d.getAttribute(Yi),magnet:d.getAttribute(hu)===vt}),L(d,Er)}else r&&(d.setAttribute(gr,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(Xe(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(Xe(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var ua=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||Lv,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind(ei,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(md,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new Us}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}Ju(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=Fe(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Fe(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),gs(o[0],r,!0)?r:n===j0||n===Lv&&(o[0].width>t||o[0].height>t)?Rx(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function xp(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,Fe(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var pi=class{constructor(r,e){this.draggableInstance=r;this.options=e;c(this,"wn");c(this,"O",{x:0,y:0});c(this,"As",{x:0,y:0});c(this,"Ss",!1);c(this,"Oe",null);typeof IntersectionObserver!="undefined"&&(this.wn=new IntersectionObserver(t=>{this.options.shouldHandle()&&t.forEach(n=>{this.Oe=n.rootBounds,n.isIntersecting?this.Jr():this.Ss||this.Ku(n.boundingClientRect)})},{root:this.draggableInstance.$getDragViewportContainer(),threshold:.99}))}updateDragElementPosition(r){this.options.shouldHandle()&&(this.Oe&&!this.Ty(r)?this.Ku(r):this.Jr())}$updateRootBounds(){this.Oe=this.draggableInstance.$getDragViewportContainer().getBoundingClientRect()}Ty(r){return this.Oe?!(r.right<this.Oe.left||r.left>this.Oe.right||r.bottom<this.Oe.top||r.top>this.Oe.bottom):!0}Ku(r){if(!this.Oe)return;let e=0,t=0;if(r.x<this.Oe.x?e=1:r.x+r.width>this.Oe.x+this.Oe.width&&(e=-1),r.y<this.Oe.y?t=1:r.y+r.height>this.Oe.y+this.Oe.height&&(t=-1),e===0&&t===0){this.Jr();return}(!this.Ss||this.As.x!==e||this.As.y!==t)&&(this.Jr(),this.As={x:e,y:t},this.Ss=!0,this.draggableInstance.$startPanRepeat(e,t,this.options.autoPanDelta,this.options.autoPanDelta,this.options.autoPanRepeat,n=>{let o=this.draggableInstance.getEffectiveVisibleZoom();this.O.x+=n.x/o,this.O.y+=n.y/o,this.options.onPan(this.O)}))}Jr(){this.draggableInstance.$stopPanRepeat(),this.Ss=!1,this.As={x:0,y:0}}reset(){this.O.x=0,this.O.y=0,this.Jr()}observe(r){this.wn!=null&&this.wn.observe(r)}unobserve(r){this.wn!=null&&(this.wn.unobserve(r),this.Jr())}disconnect(){var r;(r=this.wn)==null||r.disconnect(),this.Jr()}};var Mn="keyup",In="drag",vh="click",Ch="idle",wCe="dragging",Uf="awaitingClick",Yf="locked",bp=class extends ua{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",In);c(this,"currentState",Ch);c(this,"Dl");c(this,"Nl");c(this,"Il");c(this,"Ml");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"R");c(this,"O",{x:0,y:0});this.currentMethod=e.method||In,this.Dl=e.Dl,this.Nl=e.Nl,this.Il=e.Il,this.Ml=e.Ml,this.tapHandler=this.vy.bind(this),this.mousemoveHandler=this.Mi.bind(this),this.canvasTapHandler=this.Cy.bind(this),this.documentKeypressHandler=this.Vl.bind(this),this.surface.addDragHandler({selector:Ep,start:t=>this.Py(t),drag:t=>this.Oy(t),stop:t=>{this._y(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h=this.surface.getEffectiveVisibleZoom(),d=h*this.O.x,u=h*this.O.y,p={x:t.x-this.scrollAtPageDown.x-d,y:t.y-this.scrollAtPageDown.y-u},m=this.Ju(p,this.edgeSnapThreshold*h,this.edgeSnapSizeThreshold*h,this.edgeSnapType);return{x:m.x+this.scrollAtPageDown.x+d,y:m.y+this.scrollAtPageDown.y+u}}else return t}}),this.surface.on(this.container,W,Ep,this.tapHandler),this.surface.addDragSelectorFilter(Ep),this.currentMethod===In&&this.surface.dragOptions.autoPan!==!1&&(this.R=new pi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,onPan:t=>{this.O.x=t.x,this.O.y=t.y,this.qu()},shouldHandle:()=>!0}))}le(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,Er),H(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(gr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(document.body,Nf),F(this.surface.rootElement,Nn),this.surface.off(document,oe,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Mn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,fr),this.currentDropTarget=null),this.transientInfo!=null&&(this.O={x:0,y:0},this.R&&this.R.reset(),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Ch}Qu(e,t,n,o){var h;let s=n.getAttribute(au)||((h=e.typeDef)==null?void 0:h.edgeType),a=me(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:Ke,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},dv);let l=Object.assign({},o||{});if(s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Nn),this.R!=null){this.R.$updateRootBounds();let d=this.transientInfo.el.el.getBoundingClientRect();this.R.updateDragElementPosition(d)}}ep(e){return this.currentPagePosition={x:e.x,y:e.y},this.qu()}qu(){if(this.currentPagePosition!=null){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return this.surface.fire(Eb,this.transientEdge),{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}}rp(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:co(t)?{}:t}}Py(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===In){this.$active=!0;let t=e.el;if(t.getAttribute(gr)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=fp(this.surface,t,!0);if(n!=null){let o=this.rp(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Xr)||t.getAttribute(Ui),this.u.edgeType=t.getAttribute(au)||"";let s=t.getAttribute(zo);this.u.scope=s,this.Qu(n,e.e,t,o.payload),L(document.body,gt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(_E)===vt||this.allowLoopbackEdges,l=Th(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),this.surface.fire(gb,this.transientEdge),!0}}}}return!1}Gl(){this.surface.$stopPanRepeat()}$l(e){if(this.transientEdge!=null){he(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=zu(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?H(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):(Y(n)||K(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||xe})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=me(e);n=this.surface.fromPageLocation(s.x,s.y)}else this.surface.fire(yb);this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{let a=this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},po,null);this.surface.fire(fb,a)},()=>{})}}_y(e){this.Gl(),this.surface.$stopMotion(),this.$l(e.e),this.$active=!1}np(e,t){this.Ry();let n=e();if(this.currentMethod===vh&&this.currentState==Uf){let s=me(t);this.ep(s)}let o=yp(this.surface,this.dropTargets,n,t,this.O);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,fr),o!=null){if(L(o.targetEl,fr),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=xp(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}Mi(e){let t=me(e);this.np(()=>({x:t.x,y:t.y,width:5,height:5}),e)}Oy(e){this.np(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.ep(t),this.R!=null&&this.transientInfo!=null&&this.R.updateDragElementPosition({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height,width:n.width,height:n.height,x:n.x,y:n.y});else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}Ry(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}vy(e){if(this.currentMethod===vh&&this.currentState!==Yf){let t=e.target||e.srcElement;if(t.getAttribute(gr)!==ct){let n=fp(this.surface,t,!0);if(n!=null){if(this.currentState===Ch){he(e),this.$active=!0,this.pageDownAt=me(e),this.u={};let o=this.rp(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Xr)||t.getAttribute(Ui),this.u.edgeType=t.getAttribute(au);let s=t.getAttribute(zo);this.u.scope=s,this.currentSource=n.obj,L(document.body,Nf),this.Qu(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(_E)===vt||this.allowLoopbackEdges,l=Th(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Uf,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,oe,this.mousemoveHandler),document.addEventListener(Mn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Uf){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this.$l(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.le()}Cy(e){if(!e.defaultPrevented&&this.currentMethod===vh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=me(e);for(let n=0;n<this.dropTargets.length;n++)gs(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.$l(e),this.$_exitTapMode())}}Vl(e){this.currentState===Uf&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var Nv="primed",Iv="idle",Mv="active",Ap=class extends ua{constructor(e){super(e);c(this,"Bl");c(this,"Ts");c(this,"Bt");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"R");c(this,"O",{x:0,y:0});c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"vs",!1);c(this,"Kr");c(this,"Dn");this.Bl=e.inputHandler,this.Ts=e.method||In,this.Bt=Iv,this.documentKeypressHandler=this.Vl.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.Bt===Nv){this.Kr=At({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.Kr),this.Dn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Nn),Ft(a,[Pf],[Wu]),this.vs=!0,this.Bt=Mv,this.Bl.currentState=Yf}if(he(n),this.currentPagePosition=me(n),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom(),l=a*this.O.x,h=a*this.O.y,d={x:this.currentPagePosition.x-l,y:this.currentPagePosition.y-h},u=this.Ju(d,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType);this.currentPagePosition={x:u.x+l,y:u.y+h},this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.ip();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=yp(this.surface,this.dropTargets,o,n,this.O);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,fr),s!=null){if(L(s.targetEl,fr),s.anchor!=null)this.Kr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.Kr.isFixed=!0;else if(s.positionOnElement!=null){let a=xp(s.positionOnElement);this.Kr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.Kr.isFixed=!0}}this.currentDropTarget=s,this.R!=null&&this.R.updateDragElementPosition(this.transientVertex.el.el.getBoundingClientRect())}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(he(n),this.vs)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===it?s:o.source,a===it?o.target:s,o)===!1?this.Fl():(this.le(this.currentDropTarget.anchor),a===it?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Dn.dummy===!0?(this.surface.model.updateVertex(this.Dn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.le()):this.Fl();else(this.Ts===In||this.Bt===Mv)&&this.le();else this.le();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Bt(o.target,be(qe),this.container,!1);if(s!=null){if(this.currentEdge=this.surface.model.getEdge(s.getAttribute(qe)),this.currentEdge.transient)this.$active=!1,this.currentEdge=null,this.Bt=Iv;else if(this.Dn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),this.currentConnection.detachable||this.Dn.dummy===!0){if(this.$active=!0,this.vs=!1,this.currentIndex=n,he(o),this.O={x:0,y:0},this.currentPagePosition=me(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,oe,this.mouseMoveHandler),this.surface.on(document,se,this.mouseUpHandler),this.Bt=Nv,this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},sv),this.Ly(),L(this.currentConnection.connector.canvas,Wu),this.Ts===vh)document.addEventListener(Mn,this.documentKeypressHandler);else if(this.R!=null){this.R.$updateRootBounds();let a=this.transientVertex.el.el.getBoundingClientRect();this.R.updateDragElementPosition(a)}this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge)}}}};this.surface.on(this.container,pe,z(Zi),t(it)),this.surface.on(this.container,pe,z(Ji),t(xn)),this.Ts===In&&this.surface.dragOptions.autoPan!==!1&&(this.R=new pi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,onPan:n=>{this.O.x=n.x,this.O.y=n.y,this.ip()},shouldHandle:()=>!0}))}ip(){let e={x:this.currentPosition.x,y:this.currentPosition.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(Sd,this.currentEdge)}Fl(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.le();else{let n=this.currentEdge.id;this.le(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.O.x,y:this.currentPosition.y+this.O.y},this.currentIndex):this.surface.model.removeEdge(n)}}le(e){if(this.rtree.clear(),this.Kr=null,this.dropTargets.forEach(t=>{F(t.targetEl,Er)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(gr)}),this.disabledDropTargets.length=0,F(document.body,gt),F(this.surface.rootElement,Nn),Ft(this.currentConnection.connector.canvas,[],[Pf,Wu]),document.removeEventListener(Mn,this.documentKeypressHandler),this.surface.off(document,oe,this.mouseMoveHandler),this.surface.off(document,se,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,fr),this.currentDropTarget=null),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex!=null&&this.surface.$removeTransientVertex(this.transientVertex.el),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.vs=!1,this.Bt=Iv,this.Bl.currentState=Ch,this.Dn=null}Ly(){if(this.currentIndex===it){let e=Dv(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Th(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}Vl(e){(this.Bt===Mv||this.Bt===Nv)&&(e.keyCode===27||e.key==="Escape")&&this.Fl(!0)}};var xr="pan",mi="select",Ko="disabled",Vn="vertexDrawing";var pa="vjs-anchor-placeholder",N1="vjs-anchor-candidate",zf="vjs-connection-edit",Sp="vjs-edge-guideline",Gn="vjs-edge-handle";var Xf=z(pa),Vv=12,Gv=15;function jf(i,r,e,t){let n=G(q,e||{});L(n,r),t||(n.style.display=pt);let o=G(He,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function Z0(i,r,e,t,n,o,s){let a=G(q);L(a,n),s||(a.style.display=pt);let l=G(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function $v(i,r,e,t,n,o,s){let a=jf(t,n,o,s);return i.$appendElementToToolsLayer(a),we(a,{x:r,y:e}),a}function Bv(i,r,e,t,n,o,s,a,l,h){let d=Z0(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),we(d,{x:r,y:e}),d}function Fv(i,r,e){let t=i.faces,n=[{face:je,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:ft,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Se,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Se,[0,-1]),o.set(ht,[0,1]),o.set(je,[-1,0]),o.set(ft,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function Uv(i,r,e){let t=Ac(r,e,i.locations);return J0(t.p,e)}function Yv(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return J0(d,o)}}function J0(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var Qi=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"op");c(this,"wy");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"sp",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"pr");c(this,"mr");c(this,"Ul");c(this,"gr");c(this,"Cs");c(this,"buttonSize");c(this,"ap");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"zl");c(this,"Er");c(this,"Dy",{});c(this,"fr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||Vv,this.ap=e.anchorPlaceholderSize||Gv,this.gr=!1,this.ui.model.bind(bn,()=>{this.deactivate()}),this.ui.bind(qn,l=>{l.edge==this.currentEdge&&this.Ft()}),this.eventManager=new fe,this.$addDragHandler({selector:Xf+" *",target:Xf,constrainFunction:(l,h,d,u,p,m)=>{let g=h.Ps.anchor,E={x:l.x,y:l.y},y=!1,x=this.Er.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.fr.rotation!==0&&(y=!0,E=De(l,this.fr.center,-this.fr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.zl!=null)A=Yv(g,this.zl,x.el,b,this.Er.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(g.isContinuous){let[T,S]=Fv(g,E,f);A=T,S!=null&&(g.currentFace=S),this.$hasEdits=!0}else A=Uv(g,l,f),this.$hasEdits=!0;return g.fixedLocation=A,g.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x),y&&(l=De(l,this.fr.center,this.fr.rotation)),l},start:l=>{let d=l.el.Ps.vertex;if(this.Er=this.ui.getObjectInfo(d,!1),this.sp.length=0,this.Er.obj!=null)this.Ul=this.$cloneCurrentGeometry(),this.zl=this.currentEdge.source.id===this.Er.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.fr.rotation=this.ui.$getRotation(d.id),this.fr.rotation!==0&&(this.fr.center={x:this.Er.managedElement.t.c.x,y:this.Er.managedElement.t.c.y});else return!1},stop:l=>{this.sp.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Ul),this.Ul=null,this.Er=null},drag:l=>{this.Ft()}});let t=(l,h)=>{this.Ny(l)?h(l):Y(l)&&(Xe(this.currentEdge.source,l)?h(this.currentEdge.source):Xe(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.gr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.Iy(d)})}),this.Ft())},o=l=>{this.gr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.My(d))})};this.ui.bind(Mt,l=>{o(l)}),this.ui.bind(nr,l=>{n(l)}),this.ui.bind(Vr,l=>{o(l)}),this.ui.bind(Kc,l=>{n(l)});let s=l=>{this.gr&&this.currentEdge&&t(l.vertex,h=>this.Ft())};this.ui.model.bind(Ve,s),this.ui.model.bind(Oe,s);let a=l=>{this.gr&&this.currentEdge&&l.id===this.currentEdge.id&&this.Ft()};this.ui.bind(Sd,l=>{a(l)}),this.ui.model.bind(tn,l=>{a(l.edge)}),this.ui.model.bind(en,l=>{a(l.edge)})}isBusy(){return this.Cs}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}lp(r){return this.ui.view.getTypeDefinition(r).anchorPositions}hp(r,e){let t={type:e.type,options:Object.assign(e.options,{id:$()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}Vy(r,e){this.cp(),e.forEach(t=>{this.hp(r,t)})}cp(){this.currentOverlays.forEach(r=>{Fo(this.current,r.id)})}Gy(r){let e=r.deleteButtonClass||Ks,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.hp(this.current,{type:mr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){if(this.current){let e=Object.assign(r||{},{fireEvent:!0});this.ui.$paintConnection(this.current,e),this.Ft(r)}}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Ft(r){this.current&&(this.Yl(),this.$repaint(r))}Yl(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=jf(this.ap,pa,{[qe]:this.currentEdge.id},!0),d.Ps={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return we(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.pr),this.currentEdge.source.dummy||([this.sourceDimensions,this.pr]=r(0,this.pr)),this.ui.$removeElement(this.mr),this.currentEdge.target.dummy||([this.targetDimensions,this.mr]=r(1,this.mr))}}$y(){this.current&&(this.pr&&(this.pr.parentNode.removeChild(this.pr),delete this.pr.Ps),this.mr&&(this.mr.parentNode.removeChild(this.mr),delete this.mr.Ps)),this.pr=null,this.mr=null,this.sourceDimensions=null,this.targetDimensions=null}By(){this.current&&Bi(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.By(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.gr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;we(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this.op=this.ui.model.getEdgeType(r.data),this.wy=this.ui.view.getEdgeDefinition(this.op),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=qs(t.anchorPositions),this.targetAnchorPositionFinder=qs(t.anchorPositions);else{let n=this.lp(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=qs(n));let o=this.lp(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=qs(o))}this.$activate(e,t),t.overlays&&this.Vy(e,t.overlays),t.deleteButton===!0&&this.Gy(t),this.Yl(),Hr(this.current,zf),this.gr=!0}}deactivate(r){this.current!=null&&(this.cp(),Pr(this.current,zf),this.$y()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.gr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Cs=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=$v(this.ui,r,e,t,o,{[qe]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=Bv(this.ui,r,e,t,n,o,s,a,{[qe]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=G(Qe,{x:`${t/2}`,y:`${n/2}`,[qe]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Cs=!0),t},drag:e=>r.drag(e),stop:e=>{this.Cs=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.Dy[r.selector]=r}Iy(r){this.Yl(),this.$elementDragging(r)}My(r){this.$elementDragged(r)}Ny(r){return this.currentEdge==null?!1:r.id===eg(this.currentEdge.source)||r.id===eg(this.currentEdge.target)}};var Rr=new Map;function I1(i,r,e){let t=Rr.get(i);return new t(r,e)}function M1(i){return i.type===_n&&i.constrain===Qr?Hs:i.type}var ma=class{constructor(r,e){this.ui=r;this.Os=e;c(this,"Xl",new Map);c(this,"dp");c(this,"Xe",!1);c(this,"Nn");c(this,"ot");r.bind(Di,()=>(this.destroy(),!0)),this.Os=this.Os||{},this.dp=this.Os.hoverMode===!0,this.ui.model.bind(xt,t=>{this.Nn&&this.Nn.id===t.edge.id&&this.stopEditing()}),this.dp&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.Nn&&this.Nn.id===t.id&&(this.Xe=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Xe=!1}),li()&&(this.ui.bind(Ad,t=>{t.obj.transient||(!this.ot||!this.ot.isBusy()&&this.ot.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(bd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Xe){let t=this.pp(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=M1(t.connector);if(Rr.has(o)){if(this.ot=this.Xl.get(o),this.ot==null){let s=Object.assign({},this.Os||{});this.ot=I1(o,this.ui,s),this.Xl.set(o,this.ot)}this.Nn=n,this.ot.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.ot&&this.ot.deactivate(),this.Nn=null,this.ot=null}clearEdits(r){let e=this.pp(r);return e!=null?(Bi(e),!0):!1}pp(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):Qs(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.Xl.clear()}};function zv(){}function Tp(i,r){let e=document.createElement("div");return L(e,r.join(" ")),i.appendChild(e),e}var ga=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"_s");c(this,"el");c(this,"st");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"canvasExtent",{x:0,y:0});c(this,"O",{x:0,y:0});c(this,"Ut");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"dt");c(this,"eventManager");c(this,"jl");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",pe);c(this,"upEvent",se);c(this,"moveEvent",oe);c(this,"enabled",!1);c(this,"Hl");c(this,"mp");c(this,"Et");this.surface=r.surface,this.onStart=r.onStart||zv,this.onEnd=r.onEnd||zv,this.onSelect=r.onSelect||zv,this.onClick=r.onClick||null,this._s=r.generateLassoContent,this.jl=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.qr.bind(this),this.upListener=this.yr.bind(this),this.moveListener=this.Qr.bind(this),this.eventManager=new fe,this.Hl=r.enableInGroups===null?!0:r.enableInGroups,this.Fy(r.filter),this.invert?this.Uy():this.el=Tp(this.surface.getContainer(),[WT,r.cssClass||""]),this.st=G(Z,{width:1,height:1,x:0,y:0,fill:"transparent"}),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(bo,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)}),this.surface.addVertexDragFilter(e=>this.enabled&&this.Hl!==!1?e.vertex.objectType===le.objectType?!0:!(this.Hl==="metaKey"?e.e.metaKey:!0):!0),r.autoPan!==!1&&(this.Ut=new pi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,onPan:e=>{this.O.x=e.x,this.O.y=e.y,this.gp()},shouldHandle:()=>!0}))}Fy(r){r==null?this.dt=function(){return!1}:X(r)?this.dt=e=>{let t=e.srcElement||e.target;return $t(t,r)}:this.dt=r}Ep(r,e,t){this.visibleOrigin=r,this.size=e;let n=this.surface.fromPageLocation(r.x,r.y);if(this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height),this.invert){let o=window.innerWidth,s=window.innerHeight,a=window.pageXOffset,l=window.pageYOffset,h=s-r.y+l,d=s-h+e.height,u=o-r.x+a,p=o-u+e.width;this.masks.top.style.bottom=h+"px",this.masks.bottom.style.top=d+"px",this.masks.left.style.right=u+"px",this.masks.right.style.left=p+"px",this.masks.top.style.left=o-u+"px",this.masks.top.style.right=o-p+"px",this.masks.bottom.style.left=o-u+"px",this.masks.bottom.style.right=o-p+"px"}else{let o=this.surface.getEffectiveVisibleZoom();Qt(this.el,{x:n.x,y:n.y}),Or(this.el,e.width/o,e.height/o)}if(this.st.setAttribute("x",`${t.x}`),this.st.setAttribute("y",`${t.y}`),this.Ut!=null&&this.st.parentElement!=null){let o=this.st.getBoundingClientRect();this.Ut.updateDragElementPosition(o)}}$t(r){let e=r?Cr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,gt):this.surface.removeClass(document.body,gt)}fp(r){return this.jl==null?r:this.jl(r)}qr(r){if(this.enabled&&!this.dt(r)){he(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.O.x=0,this.O.y=0,this.hasMoved=!1;let e={width:1,height:1};this.origin=this.fp(me(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height);let t=this.surface.getElementFromEvent(r);if(!this.invert&&this._s){let n=this._s(this.origin,r);n!=null?(this.mp=n,this.el.replaceChildren(n)):this.el.innerHTML=""}this.Ep(this.origin,e,this.canvasOrigin),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r,t),this.Ut!=null&&(this.Ut.reset(),this.surface.$appendElementToToolsLayer(this.st),this.Ut.observe(this.st))}}gp(r){if(this.Et!=null){let e=this.surface.fromPageLocation(this.Et.x,this.Et.y),t={x:this.canvasOrigin.x+this.O.x,y:this.canvasOrigin.y+this.O.y},n=this.surface.toPageLocation(t.x,t.y),o={width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)},s={width:Math.abs(this.Et.x-n.x),height:Math.abs(this.Et.y-n.y)},a={x:Math.min(n.x,this.Et.x),y:Math.min(n.y,this.Et.y)},l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)};o.width>0&&o.height>0&&(this.hasMoved=!0,this.Ep(a,s,e),this.onSelect(a,s,l,o,[n.x<this.Et.x,n.y<this.Et.y],r,this.mp))}}Qr(r){this.down&&(this.moving||(this.$t(!0),this.moving=!0),he(r),this.Et=this.fp(me(r)),this.gp(r.shiftKey))}yr(r){if(this.down){this.st.parentElement&&this.st.parentElement.removeChild(this.st),this.Ut!=null&&(this.Ut.unobserve(this.st),this.Ut.reset());let e=this.moving;this.down=!1,this.moving=!1,he(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.$t(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this._s&&(this.el.innerHTML="")}}Uy(){this.masks.top=Tp(document.body,[oh,JT]),this.masks.bottom=Tp(document.body,[oh,qT]),this.masks.left=Tp(document.body,[oh,ZT]),this.masks.right=Tp(document.body,[oh,KT])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Te=class{$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var Xv="logarithmic",jv="absolute";var K0={},eo={get:i=>{let r=K0[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{K0[i]=r}};var Hf=class Hf{constructor(r){c(this,"type",Hf.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.In(r.options)}In(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}$t(r){}};c(Hf,"type","simple");var vp=Hf;eo.register(vp.type,vp);var q0="vjs-background-tile",Hv=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"zt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.zt[s]=this.zt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.zy=!0,l.className=q0,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.zt[s][a]=[l,new Image,!1]}}}Yy(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}Xy(r,e,t){return this.urlGenerator==null?this.Yy(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}jy(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.Xy(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.zt[o]!=null&&this.zt[o][s]!=null&&(this.zt[o][s][2]||(this.jy(this.zt[o][s][0],this.zt[o][s][1],o,s),this.zt[o][s][2]=!0))}},kf=class kf{constructor(r){c(this,"type",kf.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"zoomWidget");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"yp");c(this,"xp");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||Xv,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.yp=this.debounce(this.bp,this.zoomDebounceTimeout),this.xp=this.debounce(this.Ap,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new Hv(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Hy(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}ky(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}Ap(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}bp(){this.ky(this.Hy()),this.Ap()}setZoom(r,e){this.widgetZoom=r,e?this.bp():this.yp()}pan(){this.xp()}owns(r){return r===this.canvas||r.zy===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===jv?this.Wy(r):this.Zy(r)}Wy(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}Zy(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}$t(r){}};c(kf,"type","tiled");var Cp=kf;eo.register(Cp.type,Cp);var Q0=(e=>(e.dotted="dotted",e.lines="lines",e))(Q0||{}),V1="dotted",G1="lines",eL={width:50,height:50},tL=2,kv="#ddd",Ph="#ddd",$1=2,B1=1,rL="vjs-background",nL="vjs-background-border",qo="vjs-background-grid",iL="vjs-background-grid-minor",oL="vjs-background-grid-major",Pp="vjs-background-grid-dotted-major",sL="vjs-background-grid-dotted-minor",Wf=class Wf{constructor(r){c(this,"Xe",!1);c(this,"type",Wf.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"We",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"Rs");c(this,"Yi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.Rs=`p${$().substring(0,8)}`,this.Yi=`p${$().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=G(Pe),this.backgroundContainer.style.position=Ke,L(this.backgroundContainer,rL),this.$t(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Mt,e=>{this.xr()}),this.ui.bind(nr,e=>{this.xr()}),this.ui.bind(fd,()=>{this.Xe=!0}),this.ui.bind(An,()=>{this.Xe=!1,this.xr()}),this.ui.bind($r,e=>{this.xr()}),this.ui.bind(Gr,e=>{this.xr()}),this.ui.model.bind(Re,e=>{this.xr()}),this.ui.model.bind(Me,e=>{this.xr()}),this.grid=r.options.grid||this.ui.getGrid()||eL,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||tL,this.dotRadius=r.options.dotRadius||$1,this.tickDotRadius=r.options.tickDotRadius||B1,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.xr()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}xr(){this.Xe||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let o=-this.minWidth/2;o<r&&(t+=r-o,r=o);let s=this.minWidth/2;s>r+t&&(t+=s-(r+t))}if(this.minHeight!=null){let o=-this.minHeight/2;o<e&&(n+=e-o,e=o);let s=this.minHeight/2;s>e+n&&(n+=s-(e+n))}if(this.maxWidth!=null){let o=-this.maxWidth/2;o>r&&(t-=o-r,r=o);let s=this.maxWidth/2;s<r+t&&(t-=r+t-s)}if(this.maxHeight!=null){let o=-this.maxHeight/2;o>e&&(n-=o-e,e=o);let s=this.maxHeight/2;s<e+n&&(n-=e+n-s)}this.autoShrink!==!0&&(r=Math.min(r,this.We.minX),e=Math.min(e,this.We.minY),t=Math.max(r+t,this.We.maxX)-r,n=Math.max(e+n,this.We.maxY)-e),we(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.We.minX=Math.min(this.We.minX,r),this.We.minY=Math.min(this.We.minY,e),this.We.maxX=Math.max(this.We.maxX,r+t),this.We.maxY=Math.max(this.We.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}Jy(r,e){return`<pattern id="${this.Yi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
+
<path d="M ${r} 0 L 0 0 0 ${e}" class="${qo} ${iL}" fill="none" stroke="${kv}" stroke-width="1"/>
|
|
45
|
+
</pattern>`}Ky(){return`<pattern id="${this.Rs}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Yi})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${qo} ${oL}" fill="none" stroke="${Ph}" stroke-width="1.5"/></pattern>`}qy(r,e){let t=`<pattern id="${this.Yi}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`;for(let n=0;n<this.tickMarksPerCell+2;n++){let o=n*r;for(let s=0;s<this.tickMarksPerCell+2;s++){let a=s*e;t+=`<circle cx="${o}" cy="${a}" r="${this.tickDotRadius}" class="${qo} ${sL}" fill="${kv}" stroke="none"/>`}}return t+"</pattern>`"}Qy(){return`<pattern id="${this.Rs}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Yi})"/>`:"")+`<circle cx="0" cy="0" r="${this.dotRadius}" class="${qo} ${Pp}" fill="${Ph}" stroke="none"/>
|
|
46
|
+
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${qo} ${Pp}" fill="${Ph}" stroke="none"/>
|
|
47
|
+
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${qo} ${Pp}" fill="${Ph}" stroke="none"/>
|
|
48
|
+
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${qo} ${Pp}" fill="${Ph}" stroke="none"/></pattern>`}ex(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Jy(r,e):this.qy(r,e),n=()=>this.gridType==="lines"?this.Ky():this.Qy();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.ex(),e=this.showBorder?`<rect class="${nL}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.Rs})" stroke="${pt}"/>`;return r+e+t}$t(r){this.backgroundContainer.style.display=r?Cr:pt}};c(Wf,"type","grid");var Ea=Wf;eo.register(Ea.type,Ea);var Qo=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Ls",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=eo.get(n);return this.Ls=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.Ls}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.Ls)}setVisible(e){this.Ls=e,this.background.$t(e)}};c(Qo,"type","background"),nn.register(Qo.type,Qo);var _h="c-state",_p=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===pr?`${_h}-${r}`:`${_h}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${_h}-${this.id}-${a}`:null;l&&Le.addType(s,l,o.data),this.state[pr]&&Le.addType(s,`${_h}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[pr]&&L(l,this.state[pr].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${_h}-${this.id}-${a}`:null;l&&Le.removeType(s,l,o.data),this.state[pr]&&Le.removeType(s,`${_h}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[pr].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[pr]&&F(l,this.state[pr].cssClass)})}};var Zf=class{constructor(r){this.ui=r;c(this,"Sp",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.Sp[e]=new _p(e,this.viewOptions.states[e],r)}getState(r){return this.Sp[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.Tp(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.Tp(e),t.deactivate(e,this.ui,this.ui.dataSource),Dt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}Tp(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Oh=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new Zf(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Oh,"type","ui-states"),nn.register(Oh.type,Oh);var Wv="direct",F1="orthogonal",Rh=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"vp");c(this,"ae");c(this,"Ct")}destroy(){}nx(){let e=this.ui.getLayout();if(e.type!==Eo.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.vp.forEach(n=>{let o=this.mode===Wv?IA(n):NA(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==_n){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),m=this.ae[p.source.id],g=this.ae[p.target.id],E=this.Ct[p.source.id],y=this.Ct[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),Ge.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-m.x)/E.width,y:(u[0].y-m.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-g.x)/y.width,y:(u[u.length-1].y-g.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||Wv,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||Bd,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.vp=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.ae=Object.assign({},n.positions),this.Ct=Object.assign({},n.sizes),this.nx()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(Sn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(Sn,this.layoutListener)}};c(Rh,"type","edgeRouting"),nn.register(Rh.type,Rh);var aL="vjs-selected-edge-highlight",Jf=class Jf extends Te{constructor(){super(...arguments);c(this,"id",Jf.type);c(this,"Ar",new Map);c(this,"Cp",aL);c(this,"Xi");c(this,"S");c(this,"Pp",e=>{rt(e.obj)&&(this.ix(e.obj),this.lx())});c(this,"_p",e=>{rt(e.obj)&&(this.kl(e.obj.getId()),this.Op())});c(this,"Rp",e=>{this.reset()});c(this,"ws",e=>{e.edge&&this.ji(e.edge)});c(this,"Lp",e=>{e.edge&&this.ji(e.edge)});c(this,"wp",e=>{e.dragGroup.forEach(t=>this.Dp(t.vertex))})}initialise(e,t){return this.S=e,this.Cp=t&&t.className||aL,this.Xi=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(Jt,this.Pp),!0}destroy(){this.reset(),this.S.model.unbind(Jt,this.Pp)}reset(){this.Ar.forEach(e=>{this.S.$removeElement(e)}),this.Ar.clear(),this.Op()}lx(){this.S.model.bind(Kt,this._p),this.S.model.bind(rr,this.Rp),this.S.model.bind(qn,this.ws),this.S.model.bind(Qn,this.Lp),this.S.bind(nr,this.wp),this.S.bind(qn,this.ws)}Op(){this.S.model.unbind(Kt,this._p),this.S.model.unbind(rr,this.Rp),this.S.model.unbind(qn,this.ws),this.S.model.unbind(Qn,this.Lp),this.S.unbind(nr,this.wp),this.S.unbind(qn,this.ws)}$edgeRemoved(e){this.kl(e.getId())}$edgeUpdated(e){this.ji(e)}$vertexUpdated(e,t){this.Dp(e.modelObject)}Dp(e){this.Ar.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.ji(o)})}ix(e){var s;let t=e.getId();if(this.Ar.has(t)){this.ji(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=G(Z,{fill:this.Xi.fill||"none",stroke:this.Xi.stroke||"var(--vjs-color-edit)","stroke-width":this.Xi.strokeWidth||2,"stroke-dasharray":this.Xi.dashArray,"pointer-events":"none",rx:2},{},this.Cp);this.Np(o,n),this.S.$appendElementToToolsLayer(o),this.Ar.set(t,o)}ji(e){var s;let t=e.getId(),n=this.Ar.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.kl(t);return}this.Np(n,o)}kl(e){let t=this.Ar.get(e);t&&(this.S.$removeElement(t),this.Ar.delete(e))}Np(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;de(e,{x:s,y:a,width:o.width,height:o.height})}};c(Jf,"type","selected-edge-highlight");var fa=Jf;nn.register(fa.type,fa);var $n=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",mi);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[]);c(this,"Hi")}destroy(){}initialise(e,t){return e.bind(Tn,n=>{this.lasso.enabled=n===mi}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new ga({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,enableInGroups:t.enableInGroups,onStart:(n,o,s,a,l)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,l!=null&&Y(l.modelObject)?this.Hi=l:this.Hi=null,this.onStart&&this.onStart(),e.fireUnchecked(Td,{canvasPosition:o})},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0],dontIncludeNodesInsideGroups:this.Hi==null,filter:E=>this.Hi==null||Xe(E,this.Hi.modelObject)}),m=p.length,g={};for(u=0;u<m;u++)(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),g[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,m=d.length,t.includeEdges){let E={};for(u=0;u<m;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===ce.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===ce.objectType?y[f].target.getParent().id:y[f].target.id;g[b]&&g[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d),e.fireUnchecked(vd,{canvasPosition:s,canvasSize:a})},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==Ko&&e.setMode(xr),e.fireUnchecked(Cd),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c($n,"type","lasso"),$n=Je([We("lasso")],$n);var lL="vjs-surface-elastic-group-resize",Kf="elasticGroupFrame:resize",qf="elasticGroupFrame:remove",ya=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"hx");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),Rt(this.uiGroupContentArea)?this.frame=G(Z):(this.frame=G(Pe),this.frame.appendChild(G(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,lL),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=Wm(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=Wm(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.ux(),this.hx=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}ux(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.px(e,t)}px(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=Ru(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,Or(this.frame,this.width,this.height),we(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(Kf,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(qf,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}Wl(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.Wl(r,e),{movedElements:r,resizedGroups:e}}};var hL="resize";function Op(i,r,e){let t={width:i.width,height:i.height,position:i.position||Ke},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=ta(i.ns,i.type||Ze,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var Qf="vjs-node-id",Zv="vjs-miniview-type",cL="miniview",Bn=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"lassoElement");c(this,"uiBounds");c(this,"suspended");c(this,"Zl");c(this,"typeFunction");c(this,"Sr");c(this,"Ds");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"Ip");c(this,"Mp");c(this,"Vp");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"Jl");c(this,"uiBindings",[]);c(this,"Kl");c(this,"viewport");c(this,"Gt");c(this,"qr");c(this,"Qr");c(this,"yr");c(this,"ql")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,pe,this.qr),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.lassoElement.parentNode&&this.lassoElement.parentNode.removeChild(this.lassoElement),this.eventManager.off(window,hL,this.ql),F(this.containerElement,Zu),F(this.containerElement,Ju),this.Zl&&(this.eventManager.off(this.Sr,Ye,this.Kl),this.Sr.parentNode.removeChild(this.Sr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Ir,this.Jl),this.Gt&&Kl(this.containerElement,this.Gt),this.panzoom=null}mx(e){}gx(e){}oe(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.Ip=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Mp=t.showLasso!==!1,this.Vp=t.trackSelection!==!1,this.qr=this.downListener.bind(this),this.Qr=this.moveListener.bind(this),this.yr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Op({position:Ke,width:zr,height:zr,left:0,top:0,clazz:ev},this.containerElement),this.canvasElement=Op({position:SS,width:zr,height:zr,left:0,top:0,clazz:QT},this.containerElement),this.lassoElement=Op({position:Ke,width:zr,height:zr,left:0,top:0,clazz:tv}),this.suspended=t.suspended===!0,this.Zl=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.Sr=null,this.Ds=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new fe,L(this.containerElement,Zu),this.Kl=this.toggleCollapsed.bind(this),this.Zl&&(this.Sr=Op({type:"div"}),this.Sr.className=iv,this.containerElement.appendChild(this.Sr),this.ui.on(this.Sr,Ye,this.Kl)),this.viewport=this.ui.viewport,this.panzoom=new da({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>we(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.k(o),events:{pan:()=>{this.Gp()},mousedown:()=>{L(this.pannerElement,_f)},mouseup:()=>{F(this.pannerElement,_f)}},zoomRange:[-1/0,1/0]}),this.ql=ra(()=>{this.$e()},100),this.eventManager.on(window,hL,this.ql),this.enableWheelZoom!==!1&&(this.Gt=this.wheelZoom.bind(this),Jl(this.containerElement,this.Gt)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,Zu),this.eventManager.on(this.pannerElement,pe,this.qr),this.Jl=()=>{this.$e(),this.at(!0),setTimeout(()=>{this.$e(),this.at(!0)},0)},this.oe(An,this.Jl),this.setVisible(this.visible),this.oe(xl,this.$e),this.oe(ei,this.$e),this.oe(Mt,this.Ns),this.oe(nr,o=>{this.activeTracking&&this.Ns(o)}),this.oe($r,this.Ql),this.oe(fl,this.Ex),this.oe(Sn,this.fx),this.oe(Gr,this.$p),this.oe(Vr,this.Ns),this.oe(Kc,o=>{this.activeTracking&&this.Ns(o)}),this.Mp&&(this.oe(Td,o=>{this.canvasElement.appendChild(this.lassoElement),this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width="1px",this.lassoElement.style.height="1px"}),this.oe(vd,o=>{this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width=`${o.canvasSize.width}px`,this.lassoElement.style.height=`${o.canvasSize.height}px`}),this.oe(Cd,()=>{this.lassoElement.parentElement&&this.lassoElement.parentElement.removeChild(this.lassoElement)})),this.Vp&&(this.ui.model.bind(Jt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&L(s,sh)}),this.ui.model.bind(Kt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&F(s,sh)}),this.ui.model.bind(rr,o=>{Array.from(this.canvasElement.querySelectorAll(`.${sh}`)).forEach(s=>F(s,sh))}));let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&Qt(l,a)}this.at(!0)};return this.oe(Sn,n),this.oe(Is,n),this.oe(Ib,this.Mn),this.oe(yd,this.yx),this.oe(Kf,this.mx),this.oe(qf,this.gx),this.xx(),this.Ip&&(L(this.containerElement,ov),this.eventManager.on(this.canvasElement,W,be(Qf),o=>{let s=o.target.getAttribute(Qf);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.bx(),this.panzoom.setZoom(1),this.panzoom.reset(),this.$e()}Bp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=Nt(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}xx(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.$p({el:s,id:n[o].id,vertex:n[o],pos:this.Bp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.Ql({el:s,id:t[o].id,vertex:t[o],pos:this.Bp(t[o])})}(n.length>0||t.length>0)&&this.at(!0)}$p(e){this.Ql(e,nv)}$groupCollapsed(e){this.Fp(e.modelObject,!1),this.Mn({id:e.id})}$groupExpanded(e){this.Fp(e.modelObject,!0),this.Mn({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&Or(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Is(e),this.at(!0))}downListener(e){this.panning=!0,this.downAt=me(e),this.pannerAtMouseDown=ln(this.pannerElement),this.eventManager.on(document,se,this.yr),this.eventManager.on(document,oe,this.Qr),he(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=me(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.Gp(s),Qt(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,se,this.yr),this.eventManager.off(document,oe,this.Qr)}wheelZoom(e){he(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Ds=!this.Ds,this.Ds?L(this.containerElement,Ju):F(this.containerElement,Ju),this.at(!0)}at(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.$e,doNotFirePanEvent:e})}Ns(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Is(t.element)}),this.at(!0)}Ex(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);Qt(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Or(s,a.width,a.height)}});let n=Nt(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}Qt(t,n),Or(t,e.element.width,e.element.height),this.$e()}fx(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&Qt(o,n)}this.at(!0)}Ax(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}Ql(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Op({position:Ke,width:a.width+On,height:a.height+On,left:s.x,top:s.y,clazz:rv+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(Zv,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(Qf,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}Y(e.vertex)&&this.Ax(e.vertex,l),this.ui.$_dataLoading||(this.at(!0),this.$e())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Cr:pt}getPan(){return this.panzoom.getPan()}Fp(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}Mn(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+On,t.style.height=n.height+On,this.$e(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(Zv,this.typeFunction(o))}}}invalidate(e){if(e)this.Mn({id:e});else for(let t in this.vertexMap)this.Mn({id:t})}setSuspended(e,t){this.suspended=e,t&&this.$e()}Up(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.at(!0)),t||this.$e()}$nodeRemoved(e){this.Up(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.Up(e,!1)}$groupResized(e){this.Mn({id:e.element.id,size:e.newGroupSize}),this.at(!0)}Is(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);Qt(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.Is(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.Is(e))}}bx(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.$e()}yx(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}$e(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+On,this.pannerElement.style.height=this.uiBounds.vh+On,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},Qt(this.pannerElement,this.pannerPos)}}Gp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||ln(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(Bn,"type",cL),Bn=Je([We(cL)],Bn);var Jv="vjs-pan-mode",Kv="vjs-zoom-to-fit",qv="vjs-zoom-in",Qv="vjs-zoom-out",ey="vjs-select-mode",eC="vjs-undo",tC="vjs-redo",rC="vjs-clear-dataset",U1="vjs-selected-mode",Rp="vjs-controls",nC="vjs-export-controls",iC="vjs-controls-reset-selection",Y1="vjs-copy-paste-controls";var oC=class{constructor(r){c(this,"ui");this.ui=r.ui}};var z1="Clear dataset?",sC="vjs-selected-mode",dL="vjs-controls-has-selection",uL="can-undo",pL="can-redo",mL="data-undo",gL="data-redo",xa="data-mode",EL="data-reset",fL="data-clear",yL="data-zoom-in",xL="data-zoom-out",aC="data-reset-selection",bL="data-vjs-orientation",AL="0 0 32 30",SL="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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",TL="0 0 24 24",vL="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",CL="0 0 24 24",PL="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",_L="0 0 24 24",OL="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",RL="0 0 24 24",LL="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",wL="0 0 24 24",DL="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",lC="0 0 32 32",NL="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",IL="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function X1(){return`<i class="${Jv}" ${sC} ${xa}="${xr}" title="Pan Mode">
|
|
49
|
+
<svg:svg viewBox="${_L}" stroke="currentColor" fill="none"><svg:path d="${OL}"/></svg:svg>
|
|
50
|
+
</i>`}function j1(){return`<i class="${Kv}" ${EL} title="Zoom To Fit">
|
|
51
|
+
<svg:svg viewBox="${AL}" stroke="currentColor" fill="currentColor"><svg:path d="${SL}"/></svg:svg>
|
|
52
|
+
</i>`}function H1(){return`<i class="${qv}" ${yL} title="Zoom In">
|
|
53
|
+
<svg:svg viewBox="${lC}" stroke="currentColor" fill="currentColor">
|
|
54
|
+
<svg:path d="${NL}" fill="none" stroke-width="2"/>
|
|
55
55
|
</svg:svg>
|
|
56
|
-
</i>`}function
|
|
57
|
-
<svg:svg viewBox="${
|
|
58
|
-
<svg:path d="${
|
|
56
|
+
</i>`}function k1(){return`<i class="${Qv}" ${xL} title="Zoom Out">
|
|
57
|
+
<svg:svg viewBox="${lC}" stroke="currentColor" fill="currentColor">
|
|
58
|
+
<svg:path d="${IL}" fill="none" stroke-width="2"/>
|
|
59
59
|
</svg:svg>
|
|
60
|
-
</i>`}function
|
|
61
|
-
<svg:svg viewBox="${
|
|
62
|
-
</i>`}function
|
|
63
|
-
<svg:svg viewBox="${
|
|
64
|
-
</i>`}function
|
|
65
|
-
<svg:svg fill="currentColor" viewBox="${
|
|
66
|
-
</i>`}function
|
|
67
|
-
<svg:svg fill="currentColor" viewBox="${
|
|
68
|
-
</i>`}var
|
|
60
|
+
</i>`}function W1(){return`<i class="${iC}" ${aC} title="Clear Selection">
|
|
61
|
+
<svg:svg viewBox="${RL}" stroke="currentColor" fill="currentColor"><svg:path d="${LL}"/></svg:svg>
|
|
62
|
+
</i>`}function Z1(i){return`<i class="${rC}" ${fL} title="${i}">
|
|
63
|
+
<svg:svg viewBox="${wL}" stroke="currentColor" fill="currentColor"><svg:path d="${DL}"/></svg:svg>
|
|
64
|
+
</i>`}function J1(){return`<i class="${ey}" ${xa}="${mi}" title="Select Mode">
|
|
65
|
+
<svg:svg fill="currentColor" viewBox="${TL}" stroke="currentColor"><svg:path d="${vL}"/></svg:svg>
|
|
66
|
+
</i>`}function K1(){return`<i class="${ey}" ${xa}="${Vn}" title="Vertex Drawing Mode">
|
|
67
|
+
<svg:svg fill="currentColor" viewBox="${CL}" stroke="currentColor"><svg:path d="${PL}"/></svg:svg>
|
|
68
|
+
</i>`}var q1=(i,r,e)=>{let t=`<div ${bL}="${r.orientation}" class="${Rp}" ${uL}="false" ${pL}="false">`,n=e.filter(u=>u.mode!=null),o=n.map(u=>`<i data-mode="${u.mode}" class="${u.class}" title="${u.title}"></i>`).join(""),s=r.hasLasso||r.hasVertexDrawing||n.length>0?X1():"",a=(r.hasLasso?J1():"")+(r.hasVertexDrawing?K1():""),l=(r.showZoomToExtentsButton?j1():"")+(r.showZoomButtons?H1()+k1():"")+(r.showUndoRedoButtons?`<i class="${eC}" ${mL} title="Undo last action"></i><i class="${tC}" ${gL} title="Redo last action"></i>`:"")+W1()+(r.showClearButton?Z1(i):""),h="</div>",d=e.filter(u=>u.mode==null).map(u=>`<i class="${u.class}" title="${u.title}"></i>`).join("");return t+s+a+o+l+d+h},Lp=class{constructor(r,e,t){this.container=r;c(this,"V");c(this,"Ze");c(this,"eh");c(this,"S");c(this,"th");c(this,"pe");c(this,"zp");c(this,"Yp");c(this,"Xp");c(this,"jp");this.S=e,this.th=(t==null?void 0:t.clearMessage)||z1,this.zp=(t==null?void 0:t.clear)!==!1,this.Yp=(t==null?void 0:t.undoRedo)!==!1,this.Xp=(t==null?void 0:t.zoomToExtents)!==!1,this.jp=(t==null?void 0:t.zoom)===!0,this.pe=(t==null?void 0:t.orientation)||"row",this.eh=(t==null?void 0:t.buttons)||[],this.V=yr({}),this.nh(),this.Sx()}nh(){let r=this.S.getPlugin($n.type)!=null,e=this.S.getPlugin(gi.type)!=null,t=q1(this.th,{orientation:this.pe,showClearButton:this.zp,showUndoRedoButtons:this.Yp,hasLasso:r,hasVertexDrawing:e,showZoomToExtentsButton:this.Xp,showZoomButtons:this.jp},this.eh);this.Ze=this.V.template($(),{},()=>t).childNodes[0],this.container.replaceChildren(this.Ze)}Sx(){this.S.bind(xd,e=>{this.nh()}),this.S.bind(Nb,e=>{this.nh()}),this.S.model.bind(Rs,e=>{this.Ze.setAttribute(uL,e.undoCount>0?vt:ct),this.Ze.setAttribute(pL,e.redoCount>0?vt:ct)});let r=()=>{this.S.model.getSelection().isEmpty()?this.Ze.removeAttribute(dL):this.Ze.setAttribute(dL,"true")};this.S.model.bind(Jt,r),this.S.model.bind(Kt,r),this.S.model.bind(rr,r),this.S.on(this.container,W,be(mL),()=>{this.S.model.undo()}),this.S.on(this.container,W,be(gL),()=>{this.S.model.redo()}),this.S.bind(Tn,e=>{Array.from(this.Ze.querySelectorAll(be(xa))).forEach(t=>{this.S.removeClass(t,sC)}),this.S.addClass(this.S.$getSelector(this.Ze,`[${xa}='${e}']`),sC)}),this.S.on(this.container,W,be(xa),(e,t)=>{this.S.setMode(t.getAttribute(xa))}),this.S.on(this.container,W,be(EL),(e,t)=>{this.S.model.clearSelection(),this.S.zoomToFit()}),this.S.on(this.container,W,be(yL),(e,t)=>{this.S.zoomIn()}),this.S.on(this.container,W,be(xL),(e,t)=>{this.S.zoomOut()}),this.S.on(this.container,W,be(aC),()=>{this.S.model.clearSelection(),LT(this.S)&&this.S.stopEditingPath()}),this.S.on(this.container,W,be(fL),(e,t)=>{(this.S.model.getNodeCount()+this.S.model.getGroupCount()===0||confirm(this.th))&&this.S.model.clear()}),this.eh.forEach(e=>{this.S.on(this.container,W,z(e.class),(t,n)=>{e.handler&&e.handler(t,e.id)})})}};var wp="vjs-export-underlay",Dp="vjs-export-overlay",Np="vjs-export-cancel",hC="vjs-export-dimensions",cC="vjs-export-download-tools",Ip="visuallyjs-export",Mp="Download",ba={png:"image/png",svg:"image/svg+xml",jpeg:"image/jpeg"},ty="svg",Lh="png",es="jpg";function Q1(i){if(i!=null){if(X(i))return i;{let r=i,e="";for(let t in r){e+=`${t} {
|
|
69
69
|
`;for(let n in r[t])e+=`${n}:${r[t][n]};
|
|
70
70
|
`;e+=`}
|
|
71
|
-
`}return e}}else return null}function xa(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Mt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){fs(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(nf);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Mu);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Vu);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(qe);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},g=o.querySelector(".vjs-background");if(g!=null)if(t===!1)g.parentNode.removeChild(g);else{let f=i.getGrid();if(f!=null){let b=ae(p,f);p.x=b.x,p.y=b.y;let A=ae({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}g.setAttribute(Q,`${p.x}`),g.setAttribute(Ee,`${p.y}`),g.setAttribute(ve,`${p.width}`),g.setAttribute(De,`${p.height}`),g.removeAttribute("transform"),g.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let m=o.querySelector(".vjs-vertex-layer");o.removeChild(m);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([Y(ji),Y(Hi)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(ve,`${r.width}`),r.height&&o.setAttribute(De,`${r.height}`),r.style!=null){let f=B("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=N1(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function I1(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function E0(i){let r=new TextEncoder().encode(i);return I1(r)}function f0(i){return E0(i.outerHTML)}function Zv(i){let r=f0(i);return y0(r)}function y0(i){return`data:image/svg+xml;base64,${i}`}function Lp(i,r,e){let t=xa(i,r);Jf(t,r,e)}function Jf(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(ve,`${l}`),i.element.setAttribute(De,`${h}`),d.src=Zv(i.element)}var wp=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Cp,this.underlay.addEventListener(Fe,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement("div"),this.overlay.className=Pp,this.closeButton=document.createElement("div"),this.closeButton.className=Op,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Fe,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=xa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:ya.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||_p,o.innerHTML=r.downloadButtonLabel||Rp,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var _h=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(We),this.underlay.className=Cp,this.underlay.addEventListener(Fe,e=>{e.target===this.underlay&&this.Fi()}),this.overlay=document.createElement(We),this.overlay.className=Pp,this.closeButton=document.createElement(We),this.closeButton.className=Op,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Fe,()=>{this.Fi()})}Fi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Ky(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.Pp(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=Wv,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||_p,o.innerHTML=r.downloadButtonLabel||Rp,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=kv,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(ve,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(ve),10);this.Pp(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.Ky(r)}Pp(r,e,t){t&&(r.width=t,delete r.height),Lp(this.ui,r,e)}};var M1=(i,r,e,t,n)=>{let o=`<div class="${Tp} ${Uv}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${Zf}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${Oh}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${qo}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},ba=class{constructor(r,e,t){this.ui=e;c(this,"I");c(this,"We");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=M1(n,o,s,a,l);this.I=fr({templates:{component:h}}),this.We=this.I.template("component",{}).childNodes[0],r.replaceChildren(this.We),this.ui.on(this.We,W,"a",d=>{let u=d.target.dataset.type,p,g,m,E,y,x;switch(u){case Zf:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),g=new wp(this.ui),g.export(p);break;case Oh:m=t.imageOptions||{},t.margins!=null&&m.margins==null&&Object.assign(m,t.margins),y=new _h(this.ui),y.export(m);break;case qo:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new _h(this.ui),x.export(E);break}})}};var Rh="recentColors";var Ae={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Se,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var $n=Ae.Attributes,x0=Ae.Events,Oe=Ae.Elements,V1={[Oe.TEXT]:i=>i.value,[Oe.NUMBER]:i=>i.value,[Oe.RADIO]:i=>{if(i.checked)return i.value},[Oe.CHECKBOX]:i=>{if(i.checked)return!0},[Oe.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute($n.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[Oe.TEXTAREA]:i=>i.value,[Oe.COLOR]:i=>i.value,[Oe.HIDDEN]:i=>i.value};function G1(i,r){let e=i.querySelectorAll(be($n.VJS)),t={};for(let n=0;n<e.length;n++){let o=b0(e[n],r);if(o!=null){let s=e[n].getAttribute($n.VJS),a=Ce(t,s);a!=null?(Array.isArray(a)||(a=[a],Ce(t,s,a)),a.push(o)):Ce(t,s,o)}}return t}var $1={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function Dp(i,r){if(r==null)return i;try{return $1[r](i)}catch(e){return i}}function b0(i,r){let e=i.tagName.toUpperCase(),t=e===Oe.INPUT?(i.getAttribute($n.TYPE)||Oe.TEXT).toUpperCase():e,n=V1[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute($n.DATATYPE);s!=null&&(o=Dp(o,s))}}else r!=null&&(o=r(i));return o}function Jv(i,r,e,t){let n=r.querySelectorAll(be($n.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=s===Oe.INPUT?(n[o].getAttribute($n.TYPE)||Oe.TEXT).toUpperCase():s,l=n[o].getAttribute($n.VJS),h=Ce(i,l),d=F1[a];if(d!=null)d(n[o],h);else{t!=null&&t(n[o],h);continue}e!=null&&n[o].getAttribute($n.VJS_COMMIT)&&(s===Oe.INPUT?n[o].addEventListener(x0.KEYUP,u=>{(u.keyCode===10||u.keyCode===13)&&e(n[o])}):s===Oe.TEXTAREA&&n[o].addEventListener(x0.KEYUP,u=>{u.ctrlKey&&(u.keyCode===10||u.keyCode===13)&&e(n[o])}))}}function B1(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===Oe.INPUT?(i[e].getAttribute($n.TYPE)||Oe.TEXT).toUpperCase():t,o=U1[n];o&&o(i[e])}}var F1={[Oe.TEXT]:(i,r)=>{i.value=r||""},[Oe.NUMBER]:(i,r)=>{i.value=r||""},[Oe.RADIO]:(i,r)=>{i.checked=i.value==r},[Oe.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[Oe.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute($n.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[Oe.TEXTAREA]:(i,r)=>{i.value=r||""},[Oe.COLOR]:(i,r)=>{i.value=r||""},[Oe.HIDDEN]:(i,r)=>{i.value=r||""}},U1={[Oe.TEXT]:i=>{i.value=""},[Oe.RADIO]:i=>{i.checked=!1},[Oe.CHECKBOX]:i=>{i.checked=!1},[Oe.SELECT]:i=>{i.selectedIndex=-1},[Oe.TEXTAREA]:i=>{i.value=""},[Oe.COLOR]:i=>{i.value=""},[Oe.HIDDEN]:i=>{i.value=""}};var A0="input",S0="blur",T0="keypress",Kv="vjs-inspector-active",Np="vjs-inspector-inactive",v0="vjs-inspector",qv="vjs-inspector-close",Ip="change",Mp=class extends tu{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"_p");c(this,"Rp",[]);c(this,"fr",{});c(this,"kl");c(this,"Hl");c(this,"Lp");c(this,"Vi");c(this,"Wl");c(this,"yr",!1);c(this,"mt",new Map);c(this,"current",[]);c(this,"gt",{});c(this,"ct");c(this,"$getDefaultValue");c(this,"Zl");c(this,"$eventManager");c(this,"Np",()=>{this.$_recomputeCommonData(),Jv(this.gt,this.container);let e=this.container.querySelectorAll(be(Ae.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Zl&&this.Dp(),this.fire(Ip,this.gt)});this.$eventManager=new fe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new fe,this._p=e.multipleSelections!==!1,this.Wl=e.afterUpdate,this.Lp=e.renderEmptyContainer,this.Vi=e.refresh,this.kl=e.autoCommit!==!1,this.Hl=e.doNotWriteBlankNewValues!==!1,this.ct=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Zl=e.showCloseButton===!0,this.ensureContext(Rh,()=>[]),this.container.classList.add(v0),this.container.classList.add(Np),this.qy(),this.$ui.registerDataHook({load:t=>{let n=Ce(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Rh,n.recentColors.slice())},save:t=>{Ce(t,"inspectorContext",this.$context)}})}qy(){this.model.bind(ar,h=>{this.isSuspendEvents()||this.Jl(h.obj)}),this.model.bind(lr,h=>{this.et(h.obj)}),this.model.bind(Re,h=>{this.et(h.node)}),this.model.bind(Ie,h=>{this.et(h.group)}),this.model.bind(Mr,h=>{this.et(h.port)}),this.model.bind(yt,h=>{this.et(h.edge)}),this.model.bind(vr,()=>{this.kl&&Array.from(this.mt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Os,h=>{this.isSuspendEvents()||(this.yr=!0,this.Jl(),this.yr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Me,e),this.model.bind(_e,e),this.model.bind(or,t),this.model.bind(ft,n);let o=h=>{this.yr||setTimeout(()=>{let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let p=this.mt.get(u);if(p!=null&&(!p.common||p.edited)){let g=d.value;this.setValue(u,g),p.edited=!1,delete p.editedValue}}},0)};this.container.addEventListener(S0,o,!0);let s=h=>{if(!this.yr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(Ae.Attributes.VJS);if(p!=null)if(u===Ae.Elements.CHECKBOX){let g=this.gt[p],m=this.container.querySelectorAll(`input[type='checkbox'][${Ae.Attributes.VJS}='${p}']`);if(Array.isArray(g)||g==null&&m.length>1){let y=[];m.forEach(x=>{x.checked&&y.push(x.value)}),this.setValue(p,y)}else this.setValue(p,d.checked===!0)}else if(u===Ae.Elements.RADIO)d.checked&&this.setValue(p,Dp(d.value,d.getAttribute(Ae.Attributes.DATATYPE)));else if(u===Ae.Elements.COLOR||u===Ae.Elements.NUMBER||u===Ae.Elements.RANGE)this.setValue(p,d.value);else if(u===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA){let g=this.mt.get(p);g.edited=!0,g.editedValue=d.value}else d.tagName.toUpperCase()===Ae.Elements.SELECT&&this.setValue(p,Dp(d.value,d.getAttribute(Ae.Attributes.DATATYPE)))}};this.container.addEventListener(Ip,s,!0);let a=h=>{if(!this.yr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,p.editedValue=d.value}}};this.container.addEventListener(A0,a,!0);let l=h=>{if(!this.yr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.mt.get(u);p.edited=!0,this.setValue(u,d.value)}}};this.container.addEventListener(T0,l,!0),this.$ui.bind(Oi,()=>{this.container.removeEventListener(T0,l),this.container.removeEventListener(Ip,s),this.container.removeEventListener(S0,o),this.container.removeEventListener(A0,a),this.model.unbind(Me,e),this.model.unbind(_e,e),this.model.unbind(or,e),this.model.unbind(ft,n),this.Qy()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.Jl(e))}}$_recomputeCommonData(){this.gt={};let e={},t=new Set;this.current.forEach(n=>Object.keys(n.data).forEach(o=>t.add(o))),this.mt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n];t.forEach(s=>{if(!e[s]){let a=o.data[s];a==null&&this.$getDefaultValue!=null&&(a=this.$getDefaultValue(o.data,s)),this.gt[s]==null?this.gt[s]=a:this.gt[s]!==a&&(e[s]=!0,this.gt[s]="")}})}for(let n in e){let o=this.mt.get(n);o!=null&&(o.common=!0,o.commonValue=this.gt[n])}}ex(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}wp(e){this.setSuspendEvents(!0);let t=this.Hl?new Map(Object.entries(e).filter(o=>typeof o[1]=="string"&&o[1].length===0)):null,n=0;try{this.model.openTransaction();try{this.current.forEach((o,s)=>{if(this.Hl){let a=this.ex(e,o.data,t);Object.keys(a).length>0&&(this.model.update(o,a),n++)}else this.model.update(o,e),n++})}catch(o){U("WARN: error occurred updating item from inspector")}n>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.Wl&&this.Wl()}finally{this.setSuspendEvents(!1)}}nx(e){this.kl?this.wp(e):Object.assign(this.fr,e)}reset(e){try{this.yr=!0,this.fr={},this.container.classList.remove(Kv),this.container.classList.add(Np),e||(this.Lp(),this.current.length=0,this.Zl&&this.Dp())}finally{this.yr=!1}}Qy(){this.current.length=0,this.fr={},this.mt.clear(),this.container.innerHTML=""}et(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||z(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}Dp(){if(!this.container.querySelector(Y(qv))){let e=document.createElement(We);e.classList.add(qv),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}Jl(e){if(e!=null&&!this.ct(e))return;let t=!this._p||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(Np),this.container.classList.add(Kv),this.fr={},this.current.push(e),t?this.Vi(e,()=>this.$refresh()):this.Np()):this.container.classList.add(Np)}$refresh(){this.mt.clear(),this.container.querySelectorAll(be(Ae.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(Ae.Attributes.VJS);this.mt.set(n,{field:t,edited:!1,common:!1,commonValue:null,attribute:n})}),this.Np()}addValueListener(e){this.Rp.push(e)}setValue(e,t,n){this.nx({[e]:t}),this.Rp.forEach(o=>o(e,t)),n&&this.redraw()}ix(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.gt[e]}onChange(e){this.bind(Ip,e)}persist(){let e=Object.keys(this.fr).length;return e>0&&(this.wp(this.fr),this.fr={}),e}hasPendingChanges(){return Object.keys(this.fr).length>0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var C0="vjs-color-picker",Qv="vjs-color-picker-swatches",eC="vjs-color-picker-swatch",P0="vjs-color",O0="vjs-max-colors";function tC(i,r=Rh){i.registerTag(P0,{template:`<div class="${C0}">
|
|
71
|
+
`}return e}}else return null}function Aa(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Vt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){xs(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(df);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Fu);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Uu);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(qe);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},m=o.querySelector(".vjs-background");if(m!=null)if(t===!1)m.parentNode.removeChild(m);else{let f=i.getGrid();if(f!=null){let b=ae(p,f);p.x=b.x,p.y=b.y;let A=ae({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}m.setAttribute(Q,`${p.x}`),m.setAttribute(Ee,`${p.y}`),m.setAttribute(ve,`${p.width}`),m.setAttribute(Ne,`${p.height}`),m.removeAttribute("transform"),m.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let g=o.querySelector(".vjs-vertex-layer");o.removeChild(g);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([z(Zi),z(Ji)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(ve,`${r.width}`),r.height&&o.setAttribute(Ne,`${r.height}`),r.style!=null){let f=G("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=Q1(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function eG(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function ML(i){let r=new TextEncoder().encode(i);return eG(r)}function VL(i){return ML(i.outerHTML)}function dC(i){let r=VL(i);return GL(r)}function GL(i){return`data:image/svg+xml;base64,${i}`}function Vp(i,r,e){let t=Aa(i,r);ry(t,r,e)}function ry(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(ve,`${l}`),i.element.setAttribute(Ne,`${h}`),d.src=dC(i.element)}var Gp=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=wp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.ki()}),this.overlay=document.createElement("div"),this.overlay.className=Dp,this.closeButton=document.createElement("div"),this.closeButton.className=Np,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.ki()})}ki(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Aa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:ba.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||Ip,o.innerHTML=r.downloadButtonLabel||Mp,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var wh=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(Ze),this.underlay.className=wp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.ki()}),this.overlay=document.createElement(Ze),this.overlay.className=Dp,this.closeButton=document.createElement(Ze),this.closeButton.className=Np,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.ki()})}ki(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Tx(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.Hp(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=cC,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||Ip,o.innerHTML=r.downloadButtonLabel||Mp,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=hC,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(ve,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(ve),10);this.Hp(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.Tx(r)}Hp(r,e,t){t&&(r.width=t,delete r.height),Vp(this.ui,r,e)}};var tG=(i,r,e,t,n)=>{let o=`<div class="${Rp} ${nC}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${ty}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${Lh}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${es}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Sa=class{constructor(r,e,t){this.ui=e;c(this,"V");c(this,"Ze");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=tG(n,o,s,a,l);this.V=yr({templates:{component:h}}),this.Ze=this.V.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,m,g,E,y,x;switch(u){case ty:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),m=new Gp(this.ui),m.export(p);break;case Lh:g=t.imageOptions||{},t.margins!=null&&g.margins==null&&Object.assign(g,t.margins),y=new wh(this.ui),y.export(g);break;case es:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new wh(this.ui),x.export(E);break}})}};var Dh="recentColors";var Ae={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Se,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var Fn=Ae.Attributes,$L=Ae.Events,_e=Ae.Elements,rG={[_e.TEXT]:i=>i.value,[_e.NUMBER]:i=>i.value,[_e.RADIO]:i=>{if(i.checked)return i.value},[_e.CHECKBOX]:i=>{if(i.checked)return!0},[_e.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(Fn.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[_e.TEXTAREA]:i=>i.value,[_e.COLOR]:i=>i.value,[_e.HIDDEN]:i=>i.value};function nG(i,r){let e=i.querySelectorAll(be(Fn.VJS)),t={};for(let n=0;n<e.length;n++){let o=BL(e[n],r);if(o!=null){let s=e[n].getAttribute(Fn.VJS),a=Ce(t,s);a!=null?(Array.isArray(a)||(a=[a],Ce(t,s,a)),a.push(o)):Ce(t,s,o)}}return t}var iG={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function $p(i,r){if(r==null)return i;try{return iG[r](i)}catch(e){return i}}function BL(i,r){let e=i.tagName.toUpperCase(),t=e===_e.INPUT?(i.getAttribute(Fn.TYPE)||_e.TEXT).toUpperCase():e,n=rG[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(Fn.DATATYPE);s!=null&&(o=$p(o,s))}}else r!=null&&(o=r(i));return o}function uC(i,r,e,t){let n=r.querySelectorAll(be(Fn.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=s===_e.INPUT?(n[o].getAttribute(Fn.TYPE)||_e.TEXT).toUpperCase():s,l=n[o].getAttribute(Fn.VJS),h=Ce(i,l),d=sG[a];if(d!=null)d(n[o],h);else{t!=null&&t(n[o],h);continue}e!=null&&n[o].getAttribute(Fn.VJS_COMMIT)&&(s===_e.INPUT?n[o].addEventListener($L.KEYUP,u=>{(u.keyCode===10||u.keyCode===13)&&e(n[o])}):s===_e.TEXTAREA&&n[o].addEventListener($L.KEYUP,u=>{u.ctrlKey&&(u.keyCode===10||u.keyCode===13)&&e(n[o])}))}}function oG(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===_e.INPUT?(i[e].getAttribute(Fn.TYPE)||_e.TEXT).toUpperCase():t,o=aG[n];o&&o(i[e])}}var sG={[_e.TEXT]:(i,r)=>{i.value=r||""},[_e.NUMBER]:(i,r)=>{i.value=r||""},[_e.RADIO]:(i,r)=>{i.checked=i.value==r},[_e.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[_e.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute(Fn.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[_e.TEXTAREA]:(i,r)=>{i.value=r||""},[_e.COLOR]:(i,r)=>{i.value=r||""},[_e.HIDDEN]:(i,r)=>{i.value=r||""}},aG={[_e.TEXT]:i=>{i.value=""},[_e.RADIO]:i=>{i.checked=!1},[_e.CHECKBOX]:i=>{i.checked=!1},[_e.SELECT]:i=>{i.selectedIndex=-1},[_e.TEXTAREA]:i=>{i.value=""},[_e.COLOR]:i=>{i.value=""},[_e.HIDDEN]:i=>{i.value=""}};var FL="input",UL="blur",YL="keypress",pC="vjs-inspector-active",Bp="vjs-inspector-inactive",zL="vjs-inspector",mC="vjs-inspector-close",Fp="change",Up=class extends su{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"kp");c(this,"Wp",[]);c(this,"Tr",{});c(this,"ih");c(this,"oh");c(this,"Zp");c(this,"Ft");c(this,"sh");c(this,"vr",!1);c(this,"ft",new Map);c(this,"current",[]);c(this,"yt",{});c(this,"dt");c(this,"$getDefaultValue");c(this,"ah");c(this,"$eventManager");c(this,"qp",()=>{this.$_recomputeCommonData(),uC(this.yt,this.container);let e=this.container.querySelectorAll(be(Ae.Attributes.FOCUS))[0];e!=null&&e.focus(),this.ah&&this.Kp(),this.fire(Fp,this.yt)});this.$eventManager=new fe,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new fe,this.kp=e.multipleSelections!==!1,this.sh=e.afterUpdate,this.Zp=e.renderEmptyContainer,this.Ft=e.refresh,this.ih=e.autoCommit!==!1,this.oh=e.doNotWriteBlankNewValues!==!1,this.dt=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.ah=e.showCloseButton===!0,this.ensureContext(Dh,()=>[]),this.container.classList.add(zL),this.container.classList.add(Bp),this.vx(),this.$ui.registerDataHook({load:t=>{let n=Ce(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Dh,n.recentColors.slice())},save:t=>{Ce(t,"inspectorContext",this.$context)}})}vx(){this.model.bind(Jt,h=>{this.isSuspendEvents()||this.lh(h.obj)}),this.model.bind(Kt,h=>{this.tt(h.obj)}),this.model.bind(Re,h=>{this.tt(h.node)}),this.model.bind(Me,h=>{this.tt(h.group)}),this.model.bind(Mr,h=>{this.tt(h.port)}),this.model.bind(xt,h=>{this.tt(h.edge)}),this.model.bind(rr,()=>{this.ih&&Array.from(this.ft.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Rs,h=>{this.isSuspendEvents()||(this.vr=!0,this.lh(),this.vr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Ve,e),this.model.bind(Oe,e),this.model.bind(lr,t),this.model.bind(yt,n);let o=h=>{this.vr||setTimeout(()=>{let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let p=this.ft.get(u);if(p!=null&&(!p.common||p.edited)){let m=d.value;this.setValue(u,m),p.edited=!1,delete p.editedValue}}},0)};this.container.addEventListener(UL,o,!0);let s=h=>{if(!this.vr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(Ae.Attributes.VJS);if(p!=null)if(u===Ae.Elements.CHECKBOX){let m=this.yt[p],g=this.container.querySelectorAll(`input[type='checkbox'][${Ae.Attributes.VJS}='${p}']`);if(Array.isArray(m)||m==null&&g.length>1){let y=[];g.forEach(x=>{x.checked&&y.push(x.value)}),this.setValue(p,y)}else this.setValue(p,d.checked===!0)}else if(u===Ae.Elements.RADIO)d.checked&&this.setValue(p,$p(d.value,d.getAttribute(Ae.Attributes.DATATYPE)));else if(u===Ae.Elements.COLOR||u===Ae.Elements.NUMBER||u===Ae.Elements.RANGE)this.setValue(p,d.value);else if(u===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA){let m=this.ft.get(p);m.edited=!0,m.editedValue=d.value}else d.tagName.toUpperCase()===Ae.Elements.SELECT&&this.setValue(p,$p(d.value,d.getAttribute(Ae.Attributes.DATATYPE)))}};this.container.addEventListener(Fp,s,!0);let a=h=>{if(!this.vr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.ft.get(u);p.edited=!0,p.editedValue=d.value}}};this.container.addEventListener(FL,a,!0);let l=h=>{if(!this.vr){let d=h.target,u=d.getAttribute(Ae.Attributes.VJS);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===Ae.Elements.TEXT||d.tagName.toUpperCase()===Ae.Elements.TEXTAREA)){let p=this.ft.get(u);p.edited=!0,this.setValue(u,d.value)}}};this.container.addEventListener(YL,l,!0),this.$ui.bind(Di,()=>{this.container.removeEventListener(YL,l),this.container.removeEventListener(Fp,s),this.container.removeEventListener(UL,o),this.container.removeEventListener(FL,a),this.model.unbind(Ve,e),this.model.unbind(Oe,e),this.model.unbind(lr,e),this.model.unbind(yt,n),this.Cx()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.lh(e))}}$_recomputeCommonData(){this.yt={};let e={},t=new Set;this.current.forEach(n=>Object.keys(n.data).forEach(o=>t.add(o))),this.ft.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n];t.forEach(s=>{if(!e[s]){let a=o.data[s];a==null&&this.$getDefaultValue!=null&&(a=this.$getDefaultValue(o.data,s)),this.yt[s]==null?this.yt[s]=a:this.yt[s]!==a&&(e[s]=!0,this.yt[s]="")}})}for(let n in e){let o=this.ft.get(n);o!=null&&(o.common=!0,o.commonValue=this.yt[n])}}Px(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}Jp(e){this.setSuspendEvents(!0);let t=this.oh?new Map(Object.entries(e).filter(o=>typeof o[1]=="string"&&o[1].length===0)):null,n=0;try{this.model.openTransaction();try{this.current.forEach((o,s)=>{if(this.oh){let a=this.Px(e,o.data,t);Object.keys(a).length>0&&(this.model.update(o,a),n++)}else this.model.update(o,e),n++})}catch(o){U("WARN: error occurred updating item from inspector")}n>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.sh&&this.sh()}finally{this.setSuspendEvents(!1)}}Ox(e){this.ih?this.Jp(e):Object.assign(this.Tr,e)}reset(e){try{this.vr=!0,this.Tr={},this.container.classList.remove(pC),this.container.classList.add(Bp),e||(this.Zp(),this.current.length=0,this.ah&&this.Kp())}finally{this.vr=!1}}Cx(){this.current.length=0,this.Tr={},this.ft.clear(),this.container.innerHTML=""}tt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(K(e)||Y(e))&&(t=this.current.findIndex(n=>H(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}Kp(){if(!this.container.querySelector(z(mC))){let e=document.createElement(Ze);e.classList.add(mC),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}lh(e){if(e!=null&&!this.dt(e))return;let t=!this.kp||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(Bp),this.container.classList.add(pC),this.Tr={},this.current.push(e),t?this.Ft(e,()=>this.$refresh()):this.qp()):this.container.classList.add(Bp)}$refresh(){this.ft.clear(),this.container.querySelectorAll(be(Ae.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(Ae.Attributes.VJS);this.ft.set(n,{field:t,edited:!1,common:!1,commonValue:null,attribute:n})}),this.qp()}addValueListener(e){this.Wp.push(e)}setValue(e,t,n){this.Ox({[e]:t}),this.Wp.forEach(o=>o(e,t)),n&&this.redraw()}_x(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.yt[e]}onChange(e){this.bind(Fp,e)}persist(){let e=Object.keys(this.Tr).length;return e>0&&(this.Jp(this.Tr),this.Tr={}),e}hasPendingChanges(){return Object.keys(this.Tr).length>0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var XL="vjs-color-picker",gC="vjs-color-picker-swatches",EC="vjs-color-picker-swatch",jL="vjs-color",HL="vjs-max-colors";function fC(i,r=Dh){i.registerTag(jL,{template:`<div class="${XL}">
|
|
72
72
|
<input type="color"/>
|
|
73
|
-
<div class="${
|
|
73
|
+
<div class="${gC}">
|
|
74
74
|
<r-each in="$context.${r}">
|
|
75
|
-
<div class="${
|
|
75
|
+
<div class="${EC}" style="background-color:{{$value}};" data-color="{{$value}}"/>
|
|
76
76
|
</r-each>
|
|
77
77
|
</div>
|
|
78
|
-
</div>`,rendered:(e,t,n,o,s)=>{function a(
|
|
78
|
+
</div>`,rendered:(e,t,n,o,s)=>{function a(m){let g=s[r];if(g!=null&&g.find(E=>E===m)==null){let E=g.slice();return E.unshift(m),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(Ae.Attributes.VJS),h=new fe,d=e.querySelector("[type='color']"),u=e.getAttribute(HL)||10;i.bind(El,m=>{let g=e.querySelector(z(gC));g.innerHTML="",m.value.forEach(E=>{let y=document.createElement(Ze);y.className=EC,y.style.backgroundColor=E,y.setAttribute("data-color",E),g.appendChild(y)})});let p=t[l];p==null&&(p=i._x(t,l)),p&&(d.value=p,a(p)),d.onchange=m=>{let g=d.value;a(g),i.setValue(l,g,!0)},h.on(e,W,"[data-color]",m=>{let g=m.target.getAttribute("data-color");i.setValue(l,g),d.value=g}),i.addValueListener((m,g)=>{m===l&&(a(g),d.value=g)})}})}var kL="data-value",WL="vjs-edge-type-picker",Yp="vjs-edge-type-picker-selected",zp=class{constructor(r,e,t,n,o){this.ui=r;this.Ee=e;this.Rx=t;this.Qp=n;this.em=o;c(this,"entryMap",new Map);this.Ee.classList.add(WL)}render(r,e){this.Ee.innerHTML="";let t=this.Rx.find(n=>n.property===r);if(t!=null)for(let n in t.mappings){let o=t.mappings[n],s=document.createElement(Ze);s.setAttribute(kL,n),n===this.Qp&&s.classList.add(Yp);let a=this.ui.$drawAdHocEdge(o,{x:0,y:0},{x:200,y:0},o.overlays||[],o.sourceMarker,o.targetMarker,e);s.appendChild(a),this.entryMap.set(n,s),this.Ee.appendChild(s),this.ui.on(s,W,l=>{this.select(r,n)})}}select(r,e){let t=this.entryMap.get(e);if(t){this.Qp=e,this.Ee.setAttribute(kL,e);let n=this.Ee.querySelector(z(Yp));n&&n.classList.remove(Yp),t.classList.add(Yp),this.em&&this.em(r,e)}}};var ZL="vjs-edge-type",JL="edgeMappings";function lG(i){return i.getFromContext(JL)||i.$ui.$getEdgePropertyMappings()}function yC(i){i.registerTag(ZL,{template:"<div/>",rendered:(r,e)=>{let t=r.getAttribute(Ae.Attributes.VJS),n=e[t]||"";new zp(i.$ui,r,lG(i),n,(o,s)=>{i.setValue(o,s)}).render(t,e)}})}var hG="<div/>",Xp=class extends Up{constructor(e){super(Object.assign(e,{refresh:(t,n)=>{this.container.replaceChildren(this.Lx(t,this.$context)),n()},renderEmptyContainer:()=>{let t=this.V.render(this.Wi).fragment;this.container.replaceChildren(t)}}));c(this,"T");c(this,"V",yr());c(this,"Wi");c(this,"Ms");c(this,"tm",new Map);c(this,"rm",new Map);c(this,"nm",new Map);c(this,"Vs");this.T=e.ui.model,this.Vs=e.cacheTemplates!==!1,this.Ms=e.templateResolver,this.Wi=this.V.parse(e.emptyTemplate||hG),fC(this),yC(this)}registerTag(e,t){this.V.registerTag(e,t)}wx(e){let t=this.T.getPortType(e.data),n=this.nm.get(t);if(n==null){let o=this.Ms(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for port of type ${t}`),this.Wi;n=this.V.parse(o),this.Vs&&this.nm.set(t,n)}return n}im(e){let t=this.T.getNodeType(e.data),n=this.tm.get(t);if(n==null){let o=this.Ms(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for vertex of type ${t}`),this.Wi;n=this.V.parse(o),this.Vs&&this.tm.set(t,n)}return n}Dx(e){return this.im(e)}Nx(e){let t=this.T.getEdgeType(e.data),n=this.rm.get(t);if(n==null){let o=this.Ms(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for edge of type ${t}`),this.Wi;n=this.V.parse(o),this.Vs&&this.rm.set(t,n)}return n}Lx(e,t){let n;return K(e)?n=this.im(e):Y(e)?n=this.Dx(e):H(e)?n=this.wx(e):rt(e)&&(n=this.Nx(e)),this.V.render(n,e.data,null,t).fragment}};function KL(i,r){if(!i||i.length===0)return`<div class="vjs-inspector-controls">
|
|
79
79
|
<div>${r}</div>
|
|
80
80
|
</div>`;let e=`<div class="vjs-inspector-controls">
|
|
81
81
|
`;for(let t of i)e+=` <div class="vjs-inspector-control-group" style="margin-bottom: 10px;">
|
|
82
82
|
`,e+=` <label style="display:block; font-weight:bold;">${t.label}</label>
|
|
83
83
|
`,t.description&&(e+=` <small style="display:block; color:#666; margin-bottom:4px;">${t.description}</small>
|
|
84
|
-
`),e+=` ${
|
|
84
|
+
`),e+=` ${cG(t)}
|
|
85
85
|
`,e+=` </div>
|
|
86
|
-
`;return e+="</div>",e}function
|
|
86
|
+
`;return e+="</div>",e}function cG(i){switch(i.type){case"string":return`<input type="text" vjs-att="${i.id}" class="vjs-input"/>`;case"number":{let r=i.min!==void 0?` min="${i.min}"`:"",e=i.max!==void 0?` max="${i.max}"`:"";return`<input type="number" vjs-att="${i.id}"${r}${e} class="vjs-input"/>`}case"boolean":return`<input type="checkbox" vjs-att="${i.id}"/>`;case"color":return`<vjs-color vjs-att="${i.id}"></vjs-color>`;case"font":return`<div style="display:flex; gap:5px; margin-top:5px;">
|
|
87
87
|
<input type="number" placeholder="Size" style="width:60px;" vjs-att="${i.id}.size" class="vjs-input"/>
|
|
88
88
|
<input type="text" placeholder="Family" style="flex-grow:1;" vjs-att="${i.id}.family" class="vjs-input"/>
|
|
89
89
|
<select vjs-att="${i.id}.weight" class="vjs-select">
|
|
@@ -99,45 +99,45 @@ var pc=Object.defineProperty,bD=Object.defineProperties,CO=Object.getOwnProperty
|
|
|
99
99
|
<option value="italic">Italic</option>
|
|
100
100
|
<option value="oblique">Oblique</option>
|
|
101
101
|
</select>
|
|
102
|
-
</div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var nC=class extends $p{constructor(e){super(Object.assign(e,{templateResolver:t=>this.gx(t),getDefaultValue:(t,n)=>{let o=this.zp(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Rn");c(this,"_s");c(this,"Fp");c(this,"Up");this.Rn=e.ui.getShapeLibrary(),this._s=e.properties,this.Fp=e.propertyMode||"override",this.Up=e.noPropertiesMessage||"No configurable properties for this shape."}zp(e){if(this.Fp==="override"&&this._s!=null)return this._s;let t=this.Rn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Rn.getShapeSet(e.category||this.Rn.defaultCategoryId);n=o?o.properties:null}return n==null?this._s||[]:n}gx(e){if(K(e)||z(e)){let t=this.zp(e.data);return t?D0(t,this.Up):null}else return null}};var Kf="drag",iC="tap",qf="draw";var Qf=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Pn(e)}Pn(r){this.templateRenderer=new Ho({templates:{tp:r}})}setData(r,e){e&&this.Pn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function N0(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=xe),r}var I0="[data-vjs-type]";function j1(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var Aa=class{constructor(r,e){this.ui=r;c(this,"zi");c(this,"source");c(this,"Ln");c(this,"Yp");c(this,"Vt");c(this,"Gt");c(this,"Xp");c(this,"Wr");c(this,"Kl");c(this,"Yi");c(this,"ql");c(this,"Ql");c(this,"ec");c(this,"onDrag");c(this,"xr");c(this,"tc");c(this,"qt");c(this,"rc");c(this,"Rs");c(this,"nc");c(this,"Xi");c(this,"ic");c(this,"oc");c(this,"ji");c(this,"Ls");c(this,"jp");c(this,"Ze");c(this,"ki",[]);c(this,"Hi",[]);c(this,"wn",[]);c(this,"$e");c(this,"M");c(this,"Dn");c(this,"Ar");c(this,"H");c(this,"Nn");c(this,"kp");c(this,"sc");c(this,"Hp");c(this,"ws");c(this,"Wp");c(this,"lc");c(this,"Zp");c(this,"Zr");c(this,"hc");c(this,"Ae");c(this,"dc");c(this,"uc");c(this,"Wi");this.zi=e.mode||Kf,this.Ze=new fe,this.xr=e.ignoreZoom===!0,this.Yp=e.ignoreGrid===!0,this.Zr=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.ec=e.canvasDropFilter||(t=>!0),this.tc=e.elementGenerator,this.Kl=e.dataGenerator||N0,this.ql=e.typeGenerator||(t=>t.type),this.Ql=e.groupIdentifier||((t,n)=>n.getAttribute(Yl)===Tt),this.Yi=e.dragSizeGenerator,this.qt=e.enabled!==!1,this.source=e.source,this.Ln=e.selector||I0,this.uc=new Qf(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.uc.setData(e.data),this.Vt=e.dragActiveClass||jT,this.Gt=e.dragHoverClass||HT,this.Xp=e.dragElementClass||WT,this.Wr=e.dragHoverCannotDropClass||kT,this.hc=e.dragSize,this.ws=e.allowDropOnNode===!0,this.Wp=e.ignoreDropOnNode===!0,this.lc=e.allowDropOnGroup!==!1,this.Zp=e.allowDropOnEdge===!0,this.Hp=e.allowDropOnCanvas!==!1,this.rc=e.onVertexAdded,this.onDrag=e.onDrag,this.Rs=e.selectAfterAdd===!0,this.Wi=function(t){t.key==="Escape"&&(this.zi===qf?this.Ae!=null&&this.ui.setMode(yr):(this.Jp(),this.Jn()))}.bind(this),this.ui.bind(An,t=>{t===In&&this.Ae==null?this.dc!=null&&this.Kp(this.dc.el):t!==In&&this.Ae!=null&&(F(this.Ae.el,jo),F(this.ui.rootElement,ih),this.dc=this.Ae,this.Ae=null,document.removeEventListener(Nn,this.Wi))}),this.zi===Kf?this.Ex():this.zi===qf?this.fx(e):this.zi===iC&&this.yx()}setEnabled(r){this.qt=r}setData(r,e){this.uc.setData(r,e)}Kp(r){let e=Zt(r,this.Ln,this.source,!0);if(this.Ae!=null){if(F(this.Ae.el,jo),this.Ae.el===e){this.ui.setMode(yr);return}}else document.addEventListener(Nn,this.Wi);let t=this.Kl(e);this.Nn=this.Yi?this.Yi(this.$e,e):this.hc,this.Ae={el:e,data:t,objectType:e.getAttribute(Yl)===Tt?ie.objectType:de.objectType,type:this.ql(t)},L(this.Ae.el,jo),L(this.ui.rootElement,ih),this.ui.setMode(In)}qp(r,e){this.nc=t=>{if(this.qt){let n=t.target,o=Zt(n,this.Ln,this.source,!0);if(this.sc=this.xr?1:this.ui.getEffectiveVisibleZoom(),this.$e=this.Kl(o),this.ec&&!this.ec(this.$e))return;if(this.Nn=this.Yi?this.Yi(this.$e,o):this.hc,this.H=this.tc?this.tc(o,t,this.$e):r(o),this.H.removeAttribute("id"),L(this.H,this.Xp),this.H.style.position=st,this.H.style.margin="0",this.kp=this.Ql(this.$e,o)?ie.objectType:de.objectType,this.Dn=this.kp===ie.objectType?new ie(this.ui.model.graph,this.$e):new de(this.ui.model.graph,this.$e),Jt(this.H,{x:t.pageX,y:t.pageY}),!this.xr){let s=-50/this.sc;this.H.style.transform=`scale(${this.sc}) translate(${s}%,${s}%)`}e(o,this.H),document.body.appendChild(this.H),this.ji=!1,this.Ls=this.Hp===!1?!1:this.Zr!=null?this.Zr(this.Dn,null,!0):!0,this.jp=this.ui.getVisibleCanvasBounds(),this.oc=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,gt),L(this.ui.rootElement,this.Vt),this.Ze.on(document,oe,this.ic),this.ki.length=0,this.wn.length=0,!this.Wp&&this.ws&&this.ui.$getNodesInViewport().forEach(s=>{let a=s.el.el;this.ki.push({element:s.el.el,cssElement:a,r:s.el,managedElement:s.el,canDrop:this.Zr?this.Zr(this.Dn,s.el.modelObject,!1):this.ws,vertex:s.el.modelObject,id:s.el.id,objectType:de.objectType,modelObject:s.el.modelObject}),this.ws&&L(a,this.Vt)}),this.ui.$getGroupsInViewport().forEach(s=>{let a=this.ui.getGroupDefinition(s.el.modelObject);if(a.canDrop==null||a.canDrop(this.Dn)){let l=this.ui.$_getGroupContentAreaInfo(s.el.id),h=this.ui.containerType==="SVG"?s.el.el:l.contentArea;this.Hi.push({element:l.contentArea,canDrop:this.lc===!1?!1:this.Zr?this.Zr(this.Dn,s.el.modelObject,!1):!0,vertex:s.el.modelObject,managedElement:s.el,cssElement:h,id:s.el.id,objectType:ie.objectType,modelObject:s.el.modelObject,depth:Tc(s.el.modelObject),r:{x:s.el.x+l.internalOffset.x,y:s.el.y+l.internalOffset.y,width:s.el.width-l.internalOffset.x,height:s.el.height-l.internalOffset.y}}),this.lc&&L(h,this.Vt)}}),this.Hi.sort((s,a)=>a.depth-s.depth),this.Zp&&this.ui.model.getAllEdges().forEach(s=>{let a=this.ui.getRenderedConnection(s.id),l=a.connector.canvas,h=l;this.wn.push({edge:s,connection:a,connector:a.connector,element:l,cssElement:h,id:s.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(l),objectType:Be.objectType,modelObject:s}),L(h,this.Vt)}),this.Ze.on(document,Nn,this.Wi)}}}Jp(){this.Ze.off(document,oe,this.ic),this.Ze.off(document,W,this.Xi),this.Ze.off(document,se,this.Xi),F(document.body,gt),F(this.ui.rootElement,this.Wr),F(this.ui.rootElement,this.Vt),F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,ih),this.Ze.off(document,Nn,this.Wi),this.ki.forEach(r=>{F(r.cssElement,this.Vt)}),this.Hi.forEach(r=>{F(r.cssElement,this.Vt)}),this.wn.forEach(r=>{F(r.cssElement,this.Vt)}),this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.Wr))}Qp(r){this.Xi=e=>{this.Jp(),this.ji&&(this.M!=null?this.M.objectType===de.objectType&&this.M.canDrop?this.em(e,this.M.vertex):this.M.objectType===ie.objectType&&this.M.canDrop?this.xx(e):this.M.objectType===Be.objectType&&this.M.canDrop&&this.bx(e):this.Ls&&this.em(e,null)),this.Jn()}}tm(){this.ic=r=>{Jt(this.H,{x:r.pageX,y:r.pageY}),this.Nn&&_r(this.H,this.Nn.width,this.Nn.height);let e=this.ui.$getElementPositionInWindow(this.H);if(Je(this.oc,e)){if(!this.Yp&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.H.style.left=`${s.x+e.width/2}px`,this.H.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.H)}this.M!=null&&(F(this.M.cssElement,this.Gt),F(this.M.cssElement,this.Wr),this.M=null),this.Ar=j1(this.jp,this.oc,e);let t=[],n=!1;if(this.ki.forEach(o=>{Je(this.Ar,o.r)&&(t.push(o),n=o.canDrop)}),this.Hi.forEach(o=>{Je(this.Ar,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(z(o.vertex)&&z(s.vertex)){if(Ke(o.vertex,s.vertex))return-1;if(Ke(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.Wr),this.M=t[0],this.M.canDrop&&L(this.M.cssElement,this.Gt)),!n){for(let o=0;o<this.wn.length;o++){let s=this.wn[o],a=s.r,l=s.connector;if(Je(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(FA(l,u).length>0){this.M=s,L(this.M.cssElement,this.Gt);break}}}this.M==null&&(this.Ls?L(this.ui.rootElement,this.Gt):L(this.ui.rootElement,this.Wr))}this.ji=!0}else F(this.ui.rootElement,this.Gt),F(this.ui.rootElement,this.Wr),this.ji=!1;this.onDrag&&this.onDrag(this.$e,this.H,r)}}Ex(){this.tm(),this.Qp(se),this.qp(r=>r.cloneNode(!0),(r,e)=>{this.Ze.on(document,se,this.Xi)}),this.Ze.on(this.source,pe,this.Ln,this.nc)}yx(){this.tm(),this.Qp(W),this.qp(r=>{let e=r.cloneNode(!0);return this.Ze.on(e,W,this.Xi),e},(r,e)=>{L(e,"vjs-palette-tap-mode-placeholder"),L(r,jo),L(this.ui.rootElement,ih)}),this.Ze.on(this.source,W,this.Ln,this.nc)}bx(r){if(this.M.objectType===Be.objectType){let e=this.M.edge;this.ui.model.transaction(()=>{this.pc(this.$e,this.Ar,this.H,r,this.M.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},co,null),this.ui.model.$_addEdge({source:t,target:a,data:l},co,null)})},ut)}}xx(r){this.M.objectType===ie.objectType&&(this.Ar.x-=this.M.r.x,this.Ar.y-=this.M.r.y,this.pc(this.$e,this.Ar,this.H,r,this.M.vertex),this.ui.relayoutGroup(this.M.id))}em(r,e){this.pc(this.$e,this.Ar,this.H,r,e)}Ax(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===ze?t[n.x]=r[o]:o===Se?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}pc(r,e,t,n,o,s){let a=this.ql(r),l=this.Ql(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.Ax({left:e.x,top:e.y,type:a},r);o&&z(o)&&(d.group=o.id);let u=null;if(o!=null){let g=this.ui.viewport.getElementBounds(o.id);g!=null&&(u={vertex:o,pos:{x:g.x,y:g.y},size:{width:g.width,height:g.height}})}let p=this.ui.getModelPositionAttributes();if(l){let g=m=>{let E=m.data[p.x]==null?e.x:m.data[p.x],y=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,E,y),s&&s(m,E,y),this.mc(this.ui.model.getGroup(m.id),u),this.Rs&&this.ui.model.setSelection(this.ui.model.getGroup(m.id))};h==null?this.ui.model.addFactoryGroup(a,d,g,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,g,null,!1)}else this.ui.model.addFactoryNode(a,d,g=>{let m=g.data[p.x]==null?e.x:g.data[p.x],E=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,m,E),s&&s(g,m,E),this.mc(this.ui.model.getNode(g.id),u),this.Rs&&this.ui.model.setSelection(this.ui.model.getNode(g.id))},null,!1)}mc(r,e){this.rc&&this.rc({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}Jn(){Array.from(this.source.querySelectorAll(`.${jo}`)).forEach(r=>{F(r,jo)}),this.Dn=null,this.$e=null,this.ki.length=0,this.Hi.length=0,this.wn.length=0,this.H&&this.H.parentElement.removeChild(this.H),this.H=null,this.Nn=null,this.ji=!1,this.Ls=!1}fx(r){this.Ze.on(this.source,W,this.Ln,n=>{let o=n.target;this.Kp(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.Ae),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.mc(n),this.Rs&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.Ae.objectType,this.Ae.type,this.Ae.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.Ae.data)}),this.ui.addPlugin({type:ci.type,options:t})}};var Lh=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new vp(t.container,e,t),!0}destroy(){}reset(){}};c(Lh,"type","controls"),Lh=Ze([ke("controls")],Lh);var Bp=class extends Te{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new ba(t.container,e,t),!0}destroy(){}reset(){}};Bp=Ze([ke("exportControls")],Bp);var Qo=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"Zi",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.Zi=[],this.dragGroupAssigner=t.assignDragGroup,e.bind($r,n=>{this.Ji(n.el,n.vertex)}),e.bind(Gr,n=>{this.Ji(n.el,n.vertex)}),e.bind(xn,n=>{this.Sx()}),e.bind(Ns,n=>{this.Ji(n.el,n.modelObject)}),!0}destroy(){}reset(){this.Zi.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.Ji(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}Ji(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.Zi.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:oC}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}Sx(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.Zi.length;e++)this.Ji.apply(this,this.Zi[e])}};c(Qo,"type","dragGroups"),Qo=Ze([ke("dragGroups")],Qo);var Fp="vjs-snapline",sC="vjs-snapline-vertical",aC="vjs-snapline-horizontal",ey="vjs-snapline-exact",lC="vjs-snapline-active",hC="vjs-snapline-active-exact",es=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Ps,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:ze,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.gc(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:Et,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.gc(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Se,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.Ec(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.Ec(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:Nt,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.gc(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Nt,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.Ec(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(er,o=>{if(this.enabled&&o.dragGroup.length>0){this.Ds();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,g={};for(let m=0;m<this.horizontalRanges.length;m++){let E=this.horizontalRanges[m];g[E.objId]||(E.start<=l&&E.end>=l?(g[E.objId]=!0,this.In(E,l)):E.start<=a&&E.end>=a?(g[E.objId]=!0,this.In(E,a)):E.start<=h&&E.end>=h&&(g[E.objId]=!0,this.In(E,h)))}for(let m=0;m<this.verticalRanges.length;m++){let E=this.verticalRanges[m];g[E.objId]||(E.start<=u&&E.end>=u?(g[E.objId]=!0,this.In(E,u)):E.start<=d&&E.end>=d?(g[E.objId]=!0,this.In(E,d)):E.start<=p&&E.end>=p&&(g[E.objId]=!0,this.In(E,p)))}}});let n=()=>{this.enabled&&(this.Ds(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(It,o=>n()),this.surface.bind(Qc,o=>n()),!0}In(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${ey}`):e.line.classList.remove(`${ey}`);let s={x:e.orientation===Ix?-5e4:n,y:e.orientation===Oc?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${lC}`),o&&L(e.el,`${hC}`)}Ds(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${ey}`),this.surface.unfixElement(e.line),F(e.el,`${lC}`),F(e.el,`${hC}`)})}Ec(e){if(this.surface.containerType==="SVG")return Wr(Mt,Z,{y:`${e}px`},`${Fp} ${aC}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(We);return t.className=`${Fp} ${aC}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}gc(e){if(this.surface.containerType==="SVG")return Wr(Mt,Z,{x:`${e}px`},`${Fp} ${sC}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(We);return t.className=`${Fp} ${sC}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Ds()}reset(){this.Ds()}};c(es,"type","snaplines"),es=Ze([ke("snaplines")],es);var wh=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Aa(e,t),!0}reset(){}};c(wh,"type","palette"),wh=Ze([ke("palette")],wh);var ts=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"Ki",[]);c(this,"rm",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"nm",!1);c(this,"fc");c(this,"im")}initialise(e,t){return this.eventManager=new fe,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this.fc=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.rm),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,gf),this.currentPanButton=null,this.eventManager.off(document,se,this.fc)},this.im=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Se,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(ze,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(Et,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.nm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.nm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,gf),this.eventManager.on(document,se,this.fc),this.rm=window.setTimeout(()=>{this.eventManager.on(document,se,this.im),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(We);return a.innerHTML=s||"",a.style.position=st,Object.assign(a.style,t),a.className=`${pf} ${pf}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Fe,this.curryPanButton(n,o)),this.eventManager.on(a,pe,this.startPanTimer(n,o,a)),this.Ki.push(a),a}destroy(){for(let e=0;e<this.Ki.length;e++)this.Ki[e].parentNode.removeChild(this.Ki[e]);this.Ki.length=0}reset(){}};c(ts,"type","panButtons"),ts=Ze([ke("panButtons")],ts);var ty="[data-vjs-list='true']",H1="data-vjs-list-behavior",Dh=class extends Te{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"Mn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${ty}, ${ty} *`);let n=e.getContainer();return e.on(n,"wheel",ty,(o,s)=>{this.Mn||(this.Mn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.Mn=null}))}),!0}om(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(ty);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this.om(e.edge)}$edgeUpdated(e){this.om(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,H1)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=z(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let g=this.surface.getElement(p.id),E=g.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],R=T.locations[T.currentLocation].x<.5?"Left":"Right",O=`${E.bottom<=d?"Top":"Bottom"}${R}`,P=bt(O);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.Ns=f.Ns||new Set,y?f.Ns.add(b):f.Ns.delete(b),this.surface.setVisible(f,f.Ns.size===0)}),this.surface.$repaintUIElement(g,null,!1,!0)})}}destroy(){this.Mn&&(window.cancelAnimationFrame(this.Mn),this.Mn=null)}reset(){}};c(Dh,"type","listManager"),Dh=Ze([ke("listManager")],Dh);var cC="vjs-vertex-drawing-lasso",ry="vjs-group-candidate-child";var ci=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"sm");c(this,"yc");c(this,"Vn");c(this,"Gn");c(this,"Is");c(this,"Ms");c(this,"$onVertexAdded");c(this,"xc");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}Tx(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Gn=o.objectType,this.Is=o.type,this.Ms=o.data||{}}else this.nodeType!=null?(this.Gn=de.objectType,this.Is=this.nodeType,this.Ms={}):(this.Gn=ie.objectType,this.Is=this.groupType||xe,this.Ms={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&z(n.obj)?this.Vn=n.obj:this.Vn=null}initialise(e,t){this.surface=e,this.xc=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.yc=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.sm=this.yc||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${cC} ${t.lassoClass||""}`;e.bind(An,s=>{this.lasso.enabled=s===In}),this.vertexSelection=new hr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=ae(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.Tx(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Gn===ie.objectType){this.vertexSelection.clear(),this.am();let g=[],m,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(m=0;m<y;m++)g.push(E[m].v),x[E[m].id]=!0,this.vertexSelection.append(E[m].v),L(E[m].el,ry),this.selectedElements.push(E[m].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.am(),this.autoExit&&e.mode!==Zo&&e.setMode(yr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.lm(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==Zo&&e.setMode(yr),this.sm){let l=this.Gn===ie.objectType?this.defaultGroupSize:this.defaultNodeSize;this.lm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new pa(o),this.yc&&this.lasso.setEnabled(!1),!0}lm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.xc.width||t.height>=this.xc.height)&&(this.Gn===ie.objectType?this.vx(this.surface,n,t):this.Cx(this.surface,n,t))}cm(e,t){return Object.assign(this.Ms,{id:G(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Is})}Ox(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>Ke(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>Ke(o,s))==null&&n.groups.push(o)}),n}vx(e,t,n){let o;e.model.transaction(()=>{let s=this.cm(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this.Ox();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.Vn!=null&&e.model.addToGroup(o,this.Vn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Cx(e,t,n){let o;e.setSuspendRendering(!0);let s=this.cm(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.Vn!=null&&e.model.addToGroup(o,this.Vn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}am(){this.selectedElements.forEach(e=>F(e,ry)),this.selectedElements.length=0}reset(){}};c(ci,"type","vertexDrawing"),ci=Ze([ke("vertexDrawing")],ci);var Up=12,dC=40,uC=16,pC=6,gC=30,mC=30,EC=5,fC="borders",Nh="handles",yC="vjs-resize-skeleton",xC="vjs-resize-skeleton-borders",bC="vjs-resize-skeleton-borders-visible",AC="vjs-resize-frame",At="vjs-resize-handle",ny="vjs-resize-handle-active",iy="vjs-resize-handle-tl",oy="vjs-resize-handle-bl",sy="vjs-resize-handle-tr",ay="vjs-resize-handle-br",ly="vjs-resize-handle-t",hy="vjs-resize-handle-b",cy="vjs-resize-handle-l",dy="vjs-resize-handle-r",rs="vjs-resize-border",SC="vjs-resize-border-b",TC="vjs-resize-border-t",vC="vjs-resize-border-l",CC="vjs-resize-border-r",Ih="vjs-rotate-handle",zp="vjs-rotate-leader",uy="data-vjs-x-resize",py="data-vjs-y-resize",gy="data-vjs-resizable",my="data-vjs-rotatable",Sa="data-dir";function Ne(i,r,e,t){let n=B(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function Ey(i,r){we(i,r.ro),r.r!=null&&Xi(i,r.r)}var ns=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function PC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ne(Z,[At,iy],n,{"data-dir":"tl",[ee]:e.id,width:i,height:i,x:l-o,y:h-o,transform:ns(i,t)}),p.tr=Ne(Z,[At,sy],n,{"data-dir":"tr",[ee]:e.id,width:i,height:i,x:d+o,y:h-o,transform:ns(i,t)}),p.bl=Ne(Z,[At,oy],n,{"data-dir":"bl",[ee]:e.id,width:i,height:i,x:l-o,y:u+o,transform:ns(i,t)}),p.br=Ne(Z,[At,ay],n,{"data-dir":"br",[ee]:e.id,width:i,height:i,x:d+o,y:u+o,transform:ns(i,t)})),a&&(p.t=Ne(Z,[At,ly],n,{"data-dir":"t",[ee]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:ns(i,t)}),p.b=Ne(Z,[At,hy],n,{"data-dir":"b",[ee]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:ns(i,t)})),s&&(p.l=Ne(Z,[At,cy],n,{"data-dir":"l",[ee]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:ns(i,t)}),p.r=Ne(Z,[At,dy],n,{"data-dir":"r",[ee]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:ns(i,t)})),p}function OC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ne(Xe,[At,iy],n,{"data-dir":"tl",[ee]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ne(Xe,[At,sy],n,{"data-dir":"tr",[ee]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ne(Xe,[At,oy],n,{"data-dir":"bl",[ee]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ne(Xe,[At,ay],n,{"data-dir":"br",[ee]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ne(Xe,[At,ly],n,{"data-dir":"t",[ee]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ne(Xe,[At,hy],n,{"data-dir":"b",[ee]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ne(Xe,[At,cy],n,{"data-dir":"l",[ee]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ne(Xe,[At,dy],n,{"data-dir":"r",[ee]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function M0(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:t,y:n},i.grid);t=h.x,n=h.y;let d=ae({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=ae({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=ae({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=ae({x:t,y:n},i.grid).y,s=ae({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=ae({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=ae({x:t,y:n},i.grid).x,o=ae({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=ae({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function V0(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=ae({x:t,y:n},i.grid);t=l.x,n=l.y;let h=ae({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=ae({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=ae({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=ae({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=ae({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=ae({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function _C(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function RC(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var is=class extends Te{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"Jr");c(this,"Sr");c(this,"qi");c(this,"bc");c(this,"Ac");c(this,"hm");c(this,"Sc");c(this,"skeletons");c(this,"st");c(this,"Tr");c(this,"Vs");c(this,"Qi");c(this,"Gs");c(this,"te");c(this,"vr");c(this,"downAt");c(this,"Tc");c(this,"handler");c(this,"toolkitDragObject");c(this,"$s");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"vc");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"dm");c(this,"um");c(this,"Cc");c(this,"Et",!1);c(this,"Oc",!1);c(this,"Bs",!1);c(this,"$handleOffset");c(this,"Pc");c(this,"_c");c(this,"ft");c(this,"Rc");c(this,"Kr");c(this,"Se");c(this,"at");c(this,"mm");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"gm");c(this,"Em")}pm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.Et=e,this.pm(e)}set $rotating(e){this.Oc=e,this.pm(e)}get $busy(){return this.Et||this.Oc}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||EC,this.Pc=t.modelUpdater,this._c=t.handlerFactory,this.gm=M0(this),this.Em=V0(this),e.$addTransferrableVertexAttributes([gy,py,uy,my]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:gC,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:mC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.um=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.ft=t.handleSize||Up,this.Rc=t.handleShape||"circle",this.Kr=t.rotateLeaderLength||dC,this.Se=t.rotateHandleSize||uC,this.at=t.borderHandleSize||pC,this.resizeMethod=t.resizeMethod||Nh,this.bordersVisible=this.resizeMethod===fC&&t.bordersVisible!==!1,this.dm=t.rotatable===!0,this.Cc=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[At,Ih,zp,rs].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.mm=t.payloadGenerator||((a,l)=>l),this.instance.bind(vr,()=>{this.reset()}),this.instance.bind(ar,a=>{this.onDemand!==!0&&this.Lc(a.obj)}),this.instance.bind(lr,a=>{this.onDemand!==!0&&this.$n(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),z(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(er,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Me,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(_e,a=>{n(a.vertex)}),this.instance.bind(Re,a=>{this.$n(a.node)}),this.instance.bind(Ie,a=>{this.$n(a.group),a.group.getMembers().forEach(l=>this.$n(l))});let o=a=>{this.Et||this.instance.openTransaction(),this.$moving=!0,le(a);let l=this.surface.mapEventLocation(a);this.Oc?this.Px(l):this._x(l)},s=a=>{if(this.$busy){if(le(a),this.Bs&&this.st!=null){let l=new Set;if(this.te!=null){let h={},d={},u={},{movedElements:p,resizedGroups:g}=this.te.Gl();Object.assign(u,g);for(let m in p)h[m]=p[m].current,d[m]=p[m].current;for(let m in h){let E={[this.surface.$modelLeftAttribute]:h[m].x,[this.surface.$modelTopAttribute]:h[m].y};u[m]!=null&&(E[this.surface.$modelWidthAttribute]=u[m].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[m].newGroupSize.height),this.surface.model.$_updateVertex(m,E,Vs,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let m in u){let E=u[m].newGroupSize;this.surface.viewport.updateElement(m,null,null,E.width,E.height,null,null,!1)}}else l.add(this.st);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.$s&&F(this.$s,ny),this.surface.$removeClassFromElement(document.body,gt),this.surface.off(document,oe,o),this.surface.off(document,se,s),this.te&&this.te.cleanup(),this.te=null,this.st=null,this.Vs=!1,this.Qi=null,this.Gs=null,this.Tr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.Bs=!1}};return this.surface.on(this.surface.getContainer(),pe,Y(At),a=>{this.fm(a,this.gm,o,s)}),this.surface.on(this.surface.getContainer(),pe,Y(rs),a=>{this.fm(a,this.Em,o,s)}),this.surface.on(this.surface.getContainer(),pe,Y(Ih),a=>{le(a),this.Sr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(ee)),this.toolkitDragObject!=null&&(this.vr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Sr=this.vr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.vc={x:this.vr.c.x,y:this.vr.c.y},this.ym(a),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,oe,o),this.surface.on(document,se,s))}),!1}ym(e){this.toolkitDragObject!=null&&(this.st=this.toolkitDragObject.group,this.Vs=!1,this.st!=null&&(this.Qi=this.surface.getGroupDefinition(this.st),this.Gs=this.surface.$_getGroupContentAreaInfo(this.st.id),this.Tr=this.surface.viewport.getGroupElement(this.st.id),this.Vs=this.Qi.elastic===!0&&e.shiftKey!==!0,this.Vs&&(this.te=new Ea(this.surface,this.toolkitDragObject,this.st,this.Qi))))}fm(e,t,n,o){le(e);let s=e.target,a=s.getAttribute(ee);this.Jr=s.getAttribute(Sa),this.$s=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.vr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.ym(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Rx(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Sr=this.xm(),this.qi={x:l.x,y:l.y},this.Sc={width:l.width,height:l.height},this.bc=this.$x2-this.$x1,this.Ac=this.$y2-this.$y1,this.hm={x:this.$x1+this.bc/2,y:this.$y1+this.Ac/2},this.Tc=RC(this.downAt.x,this.downAt.y,this.Sr,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),z(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.um&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),g=p.xmax+u.internalOffset.x,m=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,g),this.currentMinimumHeight=Math.max(this.minimumHeight,m)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=ae({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.Jr]),this._c!=null){let h=this._c(this.surface,this.toolkitDragObject,this.Jr,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.$s,ny),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,oe,n),this.surface.on(document,se,o)}xm(){if(this.vr==null)return 0;{let t=(this.vr.r==null?0:this.vr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Lx(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.xm();return t?_C(e.x,e.y,o,n):RC(e.x,e.y,o,n)}Rx(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.wx();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}Fs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}$n(e){this.Fs(e.id)}Lc(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.$n(e),z(t.modelObject)&&t.collapsed||gn(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(uy)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(py)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(gy)===ct||!o&&!s)return;this.wc(t,e,o,s)}}wc(e,t,n,o){let s=e,a=this.resizeMethod==Nh?[yC]:[xC];this.bordersVisible&&a.push(bC);let l=Ne(q,a,null,{transform:`translate(${e.x}, ${e.y})`,[ee]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ne(Z,[AC],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(my)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.dm,g=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===Nh){if(p){g.rl=Ne(te,[zp],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Kr+this.$handleOffset}`,"stroke-width":2}),g.rh=B(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Kr-this.$handleOffset-this.Se/2})`}),l.appendChild(g.rh),Ne(Xe,[Ih],g.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let m=B(Qe,{x:`${this.Se/2}`,y:`${this.Se/2}`,"font-size":Math.floor(this.Se*.75)});m.innerHTML="\u21BA",g.rh.appendChild(m)}u&&(g.handles=this.Rc==="rectangle"?PC(this.ft,s,t,d,l,this.$handleOffset,n,o):OC(this.ft,s,t,d,l,this.$handleOffset,n,o))}else p&&(g.rl=Ne(te,[zp],l,{[ee]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.Kr+this.$handleOffset}`,"stroke-width":2}),g.rh=B(q,{transform:`translate(${s.width/2-this.Se/2}, ${-this.Kr-this.$handleOffset-this.Se/2})`}),l.appendChild(g.rh),Ne(Xe,[Ih],g.rh,{[ee]:t.id,cx:this.Se/2,cy:this.Se/2,r:this.Se/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),g.borders={t:null,b:null,l:null,r:null},u&&(o&&(g.borders.t=Ne(Z,[rs,TC],l,{[Sa]:"t",[ee]:t.id,width:s.width,height:this.at,x:0,y:-this.at/2}),g.borders.b=Ne(Z,[rs,SC],l,{[Sa]:"b",[ee]:t.id,width:s.width,height:this.at,x:0,y:s.height-this.at/2})),n&&(g.borders.r=Ne(Z,[rs,CC],l,{[Sa]:"r",[ee]:t.id,width:this.at,height:s.height,x:s.width-this.at/2,y:0}),g.borders.l=Ne(Z,[rs,vC],l,{[Sa]:"l",[ee]:t.id,width:this.at,height:s.height,x:-(this.at/2),y:0})));return Ey(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return Ey(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Se/2}, ${-this.Kr-this.$handleOffset-this.Se/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.Kr+this.$handleOffset}`),!0}return!1}Dx(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}Px(e){let t=e.x-this.vc.x,n=e.y-this.vc.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Cc!=null){let s=360/this.Cc;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Is,!1),this.Sr=o}_x(e){let t,n,o=this.Lx(e);if(t=o.x-this.Tc.x,n=o.y-this.Tc.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.Jr==="l"||this.Jr==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.Jr==="t"||this.Jr==="b")&&(t=0),this.Bs||t!=0||n!=0){this.Bs=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.st!=null&&(this.te!=null?this.te.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.Qi.constrain&&(s+l>this.Tr.width&&(l=this.Tr.width-s),a+h>this.Tr.height&&(h=this.Tr.height-a)))),this.bm(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.bc,y:this.$y1+this.handler.anchor[1]*this.Ac},p=_C(u.x,u.y,this.Sr,this.hm),g={x:s+l/2,y:a+h/2},m={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=_C(m.x,m.y,this.Sr,g),y=E.x-p.x,x=E.y-p.y,f={x:g.x-y,y:g.y-x},b=RC(p.x,p.y,this.Sr,f);this.qi={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Sc={width:l,height:h};let A=this.Dx(this.qi.x,this.qi.y,l,h),T=this.mm(this.toolkitDragObject,A)||{},S=Object.assign(T,A),R;if(this.Pc!=null&&(R=this.Pc(this.toolkitDragObject,this.qi,this.Sc)),this.instance.$_updateVertex(this.toolkitDragObject,S,xl,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],xl,!1);if(R!=null)for(let v in R)this.instance.$_updateVertex(v,R[v],xl,!1)}}wx(){return this.st==null?{x:0,y:0}:{x:this.Tr.x+this.Gs.internalOffset.x,y:this.Tr.y+this.Gs.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Lc(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==xl&&this.skeletons[e.id]!=null&&(this.Fs(e.id),setTimeout(()=>{this.Lc(e.modelObject)}))}bm(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ce(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===Nh?this.Rc==="rectangle"?(o.handles.tr&&ce(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{x:e/2}),o.handles.b&&ce(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{y:t/2}),o.handles.r&&ce(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ce(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ce(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ce(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ce(o.handles.t,{cx:e/2}),o.handles.b&&ce(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ce(o.handles.l,{cy:t/2}),o.handles.r&&ce(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ce(o.borders.t,{width:e}),o.borders.b&&ce(o.borders.b,{width:e,y:t-this.at/2}),o.borders.r&&ce(o.borders.r,{height:t,x:e-this.at/2}),o.borders.l&&ce(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.bm(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.$n(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{Ke(n.mel.modelObject,e.modelObject)&&this.Fs(n.mel.id)})}};c(is,"type","resizingTools"),is=Ze([ke("resizingTools")],is);var LC=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(LC||{}),Xp="state",Yp=class extends Vt{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===Tt?"paused":"playing"}setState(e){this.state=e,this.fire(Xp,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var Mh="startOverlayAnimation",qi="endOverlayAnimation",fy="startNodeTraversal",wC="endNodeTraversal",yy="vjs-animate-source",xy="vjs-animate-target",Bn="vjs-animate-node-traversing",Vh="vjs-animate-edge-traversing",k1="vjs-animate-node-traversable",jp="vjs-animate-edge-traversable",W1="vjs-animate-node-traversed",by="vjs-animate-edge-traversed";var DC="INITIALIZED",Ay="TRAVERSING_START",NC="TRAVERSING_EDGE",Sy="TRAVERSING_END",Ta="CANCELLED",va="FINISHED";function G0(i,r,e,t){let n=new Vt,o=r.connector.totalLength;t=t||{};let s=G(),a=t.events||{};for(let V in a)n.bind(V,a[V]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,g=o/p*1e3,m=g/d,E=1/m*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,R=h?r.targetElement:r.sourceElement,v,O=t.paused===!0,P=!1,I=!1,C=DC;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let _=V=>{I=!1,$o(r,s),window.clearInterval(b),y?V?(C=Ta,i.surface.removeClass(S,Bn),i.surface.removeClass(R,Bn),Pr(r,Vh)):(C=Sy,i.surface.addClass(R,Bn),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Bn),i.surface.removeClass(R,Bn),Pr(r,Vh),V?C=Ta:(C=va,jr(r,by),n.fire(qi,{connection:r,harness:l})))},w=()=>{f+=E,T()?_(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},$=()=>{C=NC,n.fire(Mh,{connection:r,harness:l}),A=Bl(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==va&&C!==Ta&&(i.surface.removeClass(S,Bn),n.fire(wC,{connection:r,element:S,harness:l}),$())},M=()=>{!I&&C!==va&&C!==Ta&&(C=va,i.surface.removeClass(S,Bn),i.surface.removeClass(R,Bn),Pr(r,Vh),n.fire(qi,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(fy,{connection:r,element:S,harness:l}),i.surface.addClass(S,Bn),jr(r,Vh),C=Ay,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===Ay?N():C===Sy?M():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==va&&C!==Ta&&(window.clearInterval(b),_(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(qi,D):O||D(),l}var Hp=class extends Vt{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=id(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=id(o.step,()=>{}),o.complete=id(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,g=u/d*l,m=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+g*(E+1),a.y+m*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=X(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];jr(n,jp),G0(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[qi]:()=>e.complete&&e.complete(),[Mh]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(g,m)=>{this.fire(g,{edge:m.edge,connection:m,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,yy),this.surface.addClass(u,xy),t.eachEdge((g,m)=>{jr(this.surface.$_connMap[m.id],jp)});for(let g=1;g<l;g++){let m=t.result.path[g].vertex.id,E=t.result.previous[m],y=!0,x=t.result.path[g].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=G0(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:g===l-1,forwards:y,paused:!0,events:{[fy]:f=>{h.currentlyAnimatingConnection=f.harness},[qi]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((g,m)=>{let E=this.surface.$_connMap[m.id];Pr(E,[by,jp].join(" "))}),this.surface.removeClass(d,yy),this.surface.removeClass(u,xy),n(qi,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(Mh,()=>{n(Mh,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(qi,p),h=new Yp(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(Xp,e.listener),h.fire(Xp,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var kp="vjs-shape-library-palette-set",Ty="vjs-shape-library-palette",Gh="vjs-shape-library-palette-filter",$h="vjs-shape-library-palette-shape",vy="vjs-shape-library-palette-label",IC="vjs-shape-library-palette-set-title",Cy="vjs-shape-library-palette-set-shapes",MC="vjs-shape-library-palette-lasso";var Z1=150,J1=100,K1="data-visible",Qi="data-category",Wp="data-shape-id",VC="data-show-all",GC="data-vjs-type",q1="shape-icon",$0="mainTemplate",B0="preparedTemplate",$C="setTemplate",Ca="__vjsALL";function Q1(i="Show all"){return{[$C]:`<div class="${kp}" data-category="{{id}}">
|
|
103
|
-
<div class="${
|
|
104
|
-
<div class="${
|
|
102
|
+
</div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var xC=class extends Xp{constructor(e){super(Object.assign(e,{templateResolver:t=>this.Ix(t),getDefaultValue:(t,n)=>{let o=this.am(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Vn");c(this,"Gs");c(this,"om");c(this,"sm");this.Vn=e.ui.getShapeLibrary(),this.Gs=e.properties,this.om=e.propertyMode||"override",this.sm=e.noPropertiesMessage||"No configurable properties for this shape."}am(e){if(this.om==="override"&&this.Gs!=null)return this.Gs;let t=this.Vn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Vn.getShapeSet(e.category||this.Vn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Vn.getShapeSet(e.category||this.Vn.defaultCategoryId);n=o?o.properties:null}return n==null?this.Gs||[]:n}Ix(e){if(K(e)||Y(e)){let t=this.am(e.data);return t?KL(t,this.sm):null}else return null}};var ny="drag",bC="tap",iy="draw";var oy=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.In(e)}In(r){this.templateRenderer=new Wo({templates:{tp:r}})}setData(r,e){e&&this.In(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function qL(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=xe),r}var QL="[data-vjs-type]";function dG(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var Ta=class{constructor(r,e){this.ui=r;c(this,"Zi");c(this,"source");c(this,"Gn");c(this,"lm");c(this,"Yt");c(this,"Xt");c(this,"hm");c(this,"en");c(this,"hh");c(this,"Ji");c(this,"ch");c(this,"dh");c(this,"uh");c(this,"onDrag");c(this,"Cr");c(this,"ph");c(this,"or");c(this,"mh");c(this,"$s");c(this,"gh");c(this,"Ki");c(this,"Eh");c(this,"fh");c(this,"qi");c(this,"Bs");c(this,"cm");c(this,"Je");c(this,"Qi",[]);c(this,"eo",[]);c(this,"$n",[]);c(this,"Be");c(this,"G");c(this,"Bn");c(this,"Pr");c(this,"Z");c(this,"Fn");c(this,"dm");c(this,"yh");c(this,"um");c(this,"Fs");c(this,"pm");c(this,"xh");c(this,"mm");c(this,"rn");c(this,"bh");c(this,"Te");c(this,"Ah");c(this,"Sh");c(this,"no");this.Zi=e.mode||ny,this.Je=new fe,this.Cr=e.ignoreZoom===!0,this.lm=e.ignoreGrid===!0,this.rn=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.uh=e.canvasDropFilter||(t=>!0),this.ph=e.elementGenerator,this.hh=e.dataGenerator||qL,this.ch=e.typeGenerator||(t=>t.type),this.dh=e.groupIdentifier||((t,n)=>n.getAttribute(jl)===vt),this.Ji=e.dragSizeGenerator,this.or=e.enabled!==!1,this.source=e.source,this.Gn=e.selector||QL,this.Sh=new oy(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Sh.setData(e.data),this.Yt=e.dragActiveClass||av,this.Xt=e.dragHoverClass||lv,this.hm=e.dragElementClass||cv,this.en=e.dragHoverCannotDropClass||hv,this.bh=e.dragSize,this.Fs=e.allowDropOnNode===!0,this.pm=e.ignoreDropOnNode===!0,this.xh=e.allowDropOnGroup!==!1,this.mm=e.allowDropOnEdge===!0,this.um=e.allowDropOnCanvas!==!1,this.mh=e.onVertexAdded,this.onDrag=e.onDrag,this.$s=e.selectAfterAdd===!0,this.no=function(t){t.key==="Escape"&&(this.Zi===iy?this.Te!=null&&this.ui.setMode(xr):(this.gm(),this.ii()))}.bind(this),this.ui.bind(Tn,t=>{t===Vn&&this.Te==null?this.Ah!=null&&this.Em(this.Ah.el):t!==Vn&&this.Te!=null&&(F(this.Te.el,ko),F(this.ui.rootElement,ah),this.Ah=this.Te,this.Te=null,document.removeEventListener(Mn,this.no))}),this.Zi===ny?this.Mx():this.Zi===iy?this.Vx(e):this.Zi===bC&&this.Gx()}setEnabled(r){this.or=r}setData(r,e){this.Sh.setData(r,e)}Em(r){let e=Bt(r,this.Gn,this.source,!0);if(this.Te!=null){if(F(this.Te.el,ko),this.Te.el===e){this.ui.setMode(xr);return}}else document.addEventListener(Mn,this.no);let t=this.hh(e);this.Fn=this.Ji?this.Ji(this.Be,e):this.bh,this.Te={el:e,data:t,objectType:e.getAttribute(jl)===vt?ie.objectType:le.objectType,type:this.ch(t)},L(this.Te.el,ko),L(this.ui.rootElement,ah),this.ui.setMode(Vn)}fm(r,e){this.gh=t=>{if(this.or){let n=t.target,o=Bt(n,this.Gn,this.source,!0);if(this.yh=this.Cr?1:this.ui.getEffectiveVisibleZoom(),this.Be=this.hh(o),this.uh&&!this.uh(this.Be))return;if(this.Fn=this.Ji?this.Ji(this.Be,o):this.bh,this.Z=this.ph?this.ph(o,t,this.Be):r(o),this.Z.removeAttribute("id"),L(this.Z,this.hm),this.Z.style.position=Ke,this.Z.style.margin="0",this.dm=this.dh(this.Be,o)?ie.objectType:le.objectType,this.Bn=this.dm===ie.objectType?new ie(this.ui.model.graph,this.Be):new le(this.ui.model.graph,this.Be),Qt(this.Z,{x:t.pageX,y:t.pageY}),!this.Cr){let s=-50/this.yh;this.Z.style.transform=`scale(${this.yh}) translate(${s}%,${s}%)`}e(o,this.Z),document.body.appendChild(this.Z),this.qi=!1,this.Bs=this.um===!1?!1:this.rn!=null?this.rn(this.Bn,null,!0):!0,this.cm=this.ui.getVisibleCanvasBounds(),this.fh=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,gt),L(this.ui.rootElement,this.Yt),this.Je.on(document,oe,this.Eh),this.Qi.length=0,this.$n.length=0,!this.pm&&this.Fs&&this.ui.$getNodesInViewport().forEach(s=>{let a=s.el.el;this.Qi.push({element:s.el.el,cssElement:a,r:s.el,managedElement:s.el,canDrop:this.rn?this.rn(this.Bn,s.el.modelObject,!1):this.Fs,vertex:s.el.modelObject,id:s.el.id,objectType:le.objectType,modelObject:s.el.modelObject}),this.Fs&&L(a,this.Yt)}),this.ui.$getGroupsInViewport().forEach(s=>{let a=this.ui.getGroupDefinition(s.el.modelObject);if(a.canDrop==null||a.canDrop(this.Bn)){let l=this.ui.$_getGroupContentAreaInfo(s.el.id),h=this.ui.containerType==="SVG"?s.el.el:l.contentArea;this.eo.push({element:l.contentArea,canDrop:this.xh===!1?!1:this.rn?this.rn(this.Bn,s.el.modelObject,!1):!0,vertex:s.el.modelObject,managedElement:s.el,cssElement:h,id:s.el.id,objectType:ie.objectType,modelObject:s.el.modelObject,depth:Cc(s.el.modelObject),r:{x:s.el.x+l.internalOffset.x,y:s.el.y+l.internalOffset.y,width:s.el.width-l.internalOffset.x,height:s.el.height-l.internalOffset.y}}),this.xh&&L(h,this.Yt)}}),this.eo.sort((s,a)=>a.depth-s.depth),this.mm&&this.ui.model.getAllEdges().forEach(s=>{let a=this.ui.getRenderedConnection(s.id),l=a.connector.canvas,h=l;this.$n.push({edge:s,connection:a,connector:a.connector,element:l,cssElement:h,id:s.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(l),objectType:Ue.objectType,modelObject:s}),L(h,this.Yt)}),this.Je.on(document,Mn,this.no)}}}gm(){this.Je.off(document,oe,this.Eh),this.Je.off(document,W,this.Ki),this.Je.off(document,se,this.Ki),F(document.body,gt),F(this.ui.rootElement,this.en),F(this.ui.rootElement,this.Yt),F(this.ui.rootElement,this.Xt),F(this.ui.rootElement,ah),this.Je.off(document,Mn,this.no),this.Qi.forEach(r=>{F(r.cssElement,this.Yt)}),this.eo.forEach(r=>{F(r.cssElement,this.Yt)}),this.$n.forEach(r=>{F(r.cssElement,this.Yt)}),this.G!=null&&(F(this.G.cssElement,this.Xt),F(this.G.cssElement,this.en))}ym(r){this.Ki=e=>{this.gm(),this.qi&&(this.G!=null?this.G.objectType===le.objectType&&this.G.canDrop?this.xm(e,this.G.vertex):this.G.objectType===ie.objectType&&this.G.canDrop?this.$x(e):this.G.objectType===Ue.objectType&&this.G.canDrop&&this.Bx(e):this.Bs&&this.xm(e,null)),this.ii()}}bm(){this.Eh=r=>{Qt(this.Z,{x:r.pageX,y:r.pageY}),this.Fn&&Or(this.Z,this.Fn.width,this.Fn.height);let e=this.ui.$getElementPositionInWindow(this.Z);if(tt(this.fh,e)){if(!this.lm&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.Z.style.left=`${s.x+e.width/2}px`,this.Z.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.Z)}this.G!=null&&(F(this.G.cssElement,this.Xt),F(this.G.cssElement,this.en),this.G=null),this.Pr=dG(this.cm,this.fh,e);let t=[],n=!1;if(this.Qi.forEach(o=>{tt(this.Pr,o.r)&&(t.push(o),n=o.canDrop)}),this.eo.forEach(o=>{tt(this.Pr,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(Xe(o.vertex,s.vertex))return-1;if(Xe(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Xt),F(this.ui.rootElement,this.en),this.G=t[0],this.G.canDrop&&L(this.G.cssElement,this.Xt)),!n){for(let o=0;o<this.$n.length;o++){let s=this.$n[o],a=s.r,l=s.connector;if(tt(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(tS(l,u).length>0){this.G=s,L(this.G.cssElement,this.Xt);break}}}this.G==null&&(this.Bs?L(this.ui.rootElement,this.Xt):L(this.ui.rootElement,this.en))}this.qi=!0}else F(this.ui.rootElement,this.Xt),F(this.ui.rootElement,this.en),this.qi=!1;this.onDrag&&this.onDrag(this.Be,this.Z,r)}}Mx(){this.bm(),this.ym(se),this.fm(r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,se,this.Ki)}),this.Je.on(this.source,pe,this.Gn,this.gh)}Gx(){this.bm(),this.ym(W),this.fm(r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.Ki),e},(r,e)=>{L(e,"vjs-palette-tap-mode-placeholder"),L(r,ko),L(this.ui.rootElement,ah)}),this.Je.on(this.source,W,this.Gn,this.gh)}Bx(r){if(this.G.objectType===Ue.objectType){let e=this.G.edge;this.ui.model.transaction(()=>{this.Th(this.Be,this.Pr,this.Z,r,this.G.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},po,null),this.ui.model.$_addEdge({source:t,target:a,data:l},po,null)})},ut)}}$x(r){this.G.objectType===ie.objectType&&(this.Pr.x-=this.G.r.x,this.Pr.y-=this.G.r.y,this.Th(this.Be,this.Pr,this.Z,r,this.G.vertex),this.ui.relayoutGroup(this.G.id))}xm(r,e){this.Th(this.Be,this.Pr,this.Z,r,e)}Fx(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===je?t[n.x]=r[o]:o===Se?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}Th(r,e,t,n,o,s){let a=this.ch(r),l=this.dh(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.Fx({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(d.group=o.id);let u=null;if(o!=null){let m=this.ui.viewport.getElementBounds(o.id);m!=null&&(u={vertex:o,pos:{x:m.x,y:m.y},size:{width:m.width,height:m.height}})}let p=this.ui.getModelPositionAttributes();if(l){let m=g=>{let E=g.data[p.x]==null?e.x:g.data[p.x],y=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,E,y),s&&s(g,E,y),this.Ch(this.ui.model.getGroup(g.id),u),this.$s&&this.ui.model.setSelection(this.ui.model.getGroup(g.id))};h==null?this.ui.model.addFactoryGroup(a,d,m,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,m,null,!1)}else this.ui.model.addFactoryNode(a,d,m=>{let g=m.data[p.x]==null?e.x:m.data[p.x],E=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,g,E),s&&s(m,g,E),this.Ch(this.ui.model.getNode(m.id),u),this.$s&&this.ui.model.setSelection(this.ui.model.getNode(m.id))},null,!1)}Ch(r,e){this.mh&&this.mh({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}ii(){Array.from(this.source.querySelectorAll(`.${ko}`)).forEach(r=>{F(r,ko)}),this.Bn=null,this.Be=null,this.Qi.length=0,this.eo.length=0,this.$n.length=0,this.Z&&this.Z.parentElement.removeChild(this.Z),this.Z=null,this.Fn=null,this.qi=!1,this.Bs=!1}Vx(r){this.Je.on(this.source,W,this.Gn,n=>{let o=n.target;this.Em(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.Te),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.Ch(n),this.$s&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.Te.objectType,this.Te.type,this.Te.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.Te.data)}),this.ui.addPlugin({type:gi.type,options:t})}};var Nh=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Lp(t.container,e,t),!0}destroy(){}reset(){}};c(Nh,"type","controls"),Nh=Je([We("controls")],Nh);var jp=class extends Te{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Sa(t.container,e,t),!0}destroy(){}reset(){}};jp=Je([We("exportControls")],jp);var ts=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"io",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.io=[],this.dragGroupAssigner=t.assignDragGroup,e.bind($r,n=>{this.oo(n.el,n.vertex)}),e.bind(Gr,n=>{this.oo(n.el,n.vertex)}),e.bind(An,n=>{this.Ux()}),e.bind(Ms,n=>{this.oo(n.el,n.modelObject)}),!0}destroy(){}reset(){this.io.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.oo(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}oo(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.io.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:AC}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}Ux(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.io.length;e++)this.oo.apply(this,this.io[e])}};c(ts,"type","dragGroups"),ts=Je([We("dragGroups")],ts);var Hp="vjs-snapline",SC="vjs-snapline-vertical",TC="vjs-snapline-horizontal",sy="vjs-snapline-exact",vC="vjs-snapline-active",CC="vjs-snapline-active-exact",rs=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Os,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:je,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.Ph(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:ft,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.Ph(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Se,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.Oh(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.Oh(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:It,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.Ph(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:It,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.Oh(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(nr,o=>{if(this.enabled&&o.dragGroup.length>0){this.Us();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,m={};for(let g=0;g<this.horizontalRanges.length;g++){let E=this.horizontalRanges[g];m[E.objId]||(E.start<=l&&E.end>=l?(m[E.objId]=!0,this.Un(E,l)):E.start<=a&&E.end>=a?(m[E.objId]=!0,this.Un(E,a)):E.start<=h&&E.end>=h&&(m[E.objId]=!0,this.Un(E,h)))}for(let g=0;g<this.verticalRanges.length;g++){let E=this.verticalRanges[g];m[E.objId]||(E.start<=u&&E.end>=u?(m[E.objId]=!0,this.Un(E,u)):E.start<=d&&E.end>=d?(m[E.objId]=!0,this.Un(E,d)):E.start<=p&&E.end>=p&&(m[E.objId]=!0,this.Un(E,p)))}}});let n=()=>{this.enabled&&(this.Us(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(Mt,o=>n()),this.surface.bind(td,o=>n()),!0}Un(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${sy}`):e.line.classList.remove(`${sy}`);let s={x:e.orientation===jx?-5e4:n,y:e.orientation===Rc?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${vC}`),o&&L(e.el,`${CC}`)}Us(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${sy}`),this.surface.unfixElement(e.line),F(e.el,`${vC}`),F(e.el,`${CC}`)})}Oh(e){if(this.surface.containerType==="SVG")return Zr(Vt,Z,{y:`${e}px`},`${Hp} ${TC}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(Ze);return t.className=`${Hp} ${TC}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}Ph(e){if(this.surface.containerType==="SVG")return Zr(Vt,Z,{x:`${e}px`},`${Hp} ${SC}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(Ze);return t.className=`${Hp} ${SC}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Us()}reset(){this.Us()}};c(rs,"type","snaplines"),rs=Je([We("snaplines")],rs);var Ih=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Ta(e,t),!0}reset(){}};c(Ih,"type","palette"),Ih=Je([We("palette")],Ih);var ns=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"ao",[]);c(this,"Am",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"Sm",!1);c(this,"_h");c(this,"Tm")}initialise(e,t){return this.eventManager=new fe,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this._h=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.Am),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,Af),this.currentPanButton=null,this.eventManager.off(document,se,this._h)},this.Tm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Se,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(je,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(ft,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.Sm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.Sm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,Af),this.eventManager.on(document,se,this._h),this.Am=window.setTimeout(()=>{this.eventManager.on(document,se,this.Tm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(Ze);return a.innerHTML=s||"",a.style.position=Ke,Object.assign(a.style,t),a.className=`${bf} ${bf}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Ye,this.curryPanButton(n,o)),this.eventManager.on(a,pe,this.startPanTimer(n,o,a)),this.ao.push(a),a}destroy(){for(let e=0;e<this.ao.length;e++)this.ao[e].parentNode.removeChild(this.ao[e]);this.ao.length=0}reset(){}};c(ns,"type","panButtons"),ns=Je([We("panButtons")],ns);var ay="[data-vjs-list='true']",uG="data-vjs-list-behavior",Mh=class extends Te{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"zn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${ay}, ${ay} *`);let n=e.getContainer();return e.on(n,"wheel",ay,(o,s)=>{this.zn||(this.zn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.zn=null}))}),!0}vm(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(ay);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this.vm(e.edge)}$edgeUpdated(e){this.vm(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,uG)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=Y(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let m=this.surface.getElement(p.id),E=m.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],R=T.locations[T.currentLocation].x<.5?"Left":"Right",_=`${E.bottom<=d?"Top":"Bottom"}${R}`,P=At(_);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.zs=f.zs||new Set,y?f.zs.add(b):f.zs.delete(b),this.surface.setVisible(f,f.zs.size===0)}),this.surface.$repaintUIElement(m,null,!1,!0)})}}destroy(){this.zn&&(window.cancelAnimationFrame(this.zn),this.zn=null)}reset(){}};c(Mh,"type","listManager"),Mh=Je([We("listManager")],Mh);var PC="vjs-vertex-drawing-lasso",ly="vjs-group-candidate-child";var gi=class extends Te{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"Cm");c(this,"Rh");c(this,"Yn");c(this,"Xn");c(this,"Ys");c(this,"Xs");c(this,"$onVertexAdded");c(this,"Lh");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}zx(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Xn=o.objectType,this.Ys=o.type,this.Xs=o.data||{}}else this.nodeType!=null?(this.Xn=le.objectType,this.Ys=this.nodeType,this.Xs={}):(this.Xn=ie.objectType,this.Ys=this.groupType||xe,this.Xs={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.Yn=n.obj:this.Yn=null}initialise(e,t){this.surface=e,this.Lh=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Rh=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.Cm=this.Rh||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${PC} ${t.lassoClass||""}`;e.bind(Tn,s=>{this.lasso.enabled=s===Vn}),this.vertexSelection=new cr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=ae(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.zx(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Xn===ie.objectType){this.vertexSelection.clear(),this.Pm();let m=[],g,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(g=0;g<y;g++)m.push(E[g].v),x[E[g].id]=!0,this.vertexSelection.append(E[g].v),L(E[g].el,ly),this.selectedElements.push(E[g].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.Pm(),this.autoExit&&e.mode!==Ko&&e.setMode(xr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.Om(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==Ko&&e.setMode(xr),this.Cm){let l=this.Xn===ie.objectType?this.defaultGroupSize:this.defaultNodeSize;this.Om(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new ga(o),this.Rh&&this.lasso.setEnabled(!1),!0}Om(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Lh.width||t.height>=this.Lh.height)&&(this.Xn===ie.objectType?this.Yx(this.surface,n,t):this.Xx(this.surface,n,t))}_m(e,t){return Object.assign(this.Xs,{id:$(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Ys})}jx(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>Xe(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>Xe(o,s))==null&&n.groups.push(o)}),n}Yx(e,t,n){let o;e.model.transaction(()=>{let s=this._m(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this.jx();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),m=p.x-t.x,g=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:m,[e.$modelTopAttribute]:g}),h.push({v:u,x:m,y:g})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.Yn!=null&&e.model.addToGroup(o,this.Yn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Xx(e,t,n){let o;e.setSuspendRendering(!0);let s=this._m(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.Yn!=null&&e.model.addToGroup(o,this.Yn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Pm(){this.selectedElements.forEach(e=>F(e,ly)),this.selectedElements.length=0}reset(){}};c(gi,"type","vertexDrawing"),gi=Je([We("vertexDrawing")],gi);var kp=12,_C=40,OC=16,RC=6,LC=30,wC=30,DC=5,NC="borders",Vh="handles",IC="vjs-resize-skeleton",MC="vjs-resize-skeleton-borders",VC="vjs-resize-skeleton-borders-visible",GC="vjs-resize-frame",St="vjs-resize-handle",hy="vjs-resize-handle-active",cy="vjs-resize-handle-tl",dy="vjs-resize-handle-bl",uy="vjs-resize-handle-tr",py="vjs-resize-handle-br",my="vjs-resize-handle-t",gy="vjs-resize-handle-b",Ey="vjs-resize-handle-l",fy="vjs-resize-handle-r",is="vjs-resize-border",$C="vjs-resize-border-b",BC="vjs-resize-border-t",FC="vjs-resize-border-l",UC="vjs-resize-border-r",Gh="vjs-rotate-handle",Wp="vjs-rotate-leader",yy="data-vjs-x-resize",xy="data-vjs-y-resize",by="data-vjs-resizable",Ay="data-vjs-rotatable",va="data-dir";function Ie(i,r,e,t){let n=G(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function Sy(i,r){we(i,r.ro),r.r!=null&&di(i,r.r)}var os=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function YC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ie(Z,[St,cy],n,{"data-dir":"tl",[te]:e.id,width:i,height:i,x:l-o,y:h-o,transform:os(i,t)}),p.tr=Ie(Z,[St,uy],n,{"data-dir":"tr",[te]:e.id,width:i,height:i,x:d+o,y:h-o,transform:os(i,t)}),p.bl=Ie(Z,[St,dy],n,{"data-dir":"bl",[te]:e.id,width:i,height:i,x:l-o,y:u+o,transform:os(i,t)}),p.br=Ie(Z,[St,py],n,{"data-dir":"br",[te]:e.id,width:i,height:i,x:d+o,y:u+o,transform:os(i,t)})),a&&(p.t=Ie(Z,[St,my],n,{"data-dir":"t",[te]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:os(i,t)}),p.b=Ie(Z,[St,gy],n,{"data-dir":"b",[te]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:os(i,t)})),s&&(p.l=Ie(Z,[St,Ey],n,{"data-dir":"l",[te]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:os(i,t)}),p.r=Ie(Z,[St,fy],n,{"data-dir":"r",[te]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:os(i,t)})),p}function zC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ie(He,[St,cy],n,{"data-dir":"tl",[te]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ie(He,[St,uy],n,{"data-dir":"tr",[te]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ie(He,[St,dy],n,{"data-dir":"bl",[te]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ie(He,[St,py],n,{"data-dir":"br",[te]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ie(He,[St,my],n,{"data-dir":"t",[te]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ie(He,[St,gy],n,{"data-dir":"b",[te]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ie(He,[St,Ey],n,{"data-dir":"l",[te]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ie(He,[St,fy],n,{"data-dir":"r",[te]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function ew(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:t,y:n},i.grid);t=h.x,n=h.y;let d=ae({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=ae({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=ae({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=ae({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=ae({x:t,y:n},i.grid).y,s=ae({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=ae({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=ae({x:t,y:n},i.grid).x,o=ae({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=ae({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function tw(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=ae({x:t,y:n},i.grid);t=l.x,n=l.y;let h=ae({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=ae({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=ae({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=ae({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=ae({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=ae({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function XC(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function jC(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var ss=class extends Te{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"nn");c(this,"Or");c(this,"lo");c(this,"Dh");c(this,"Nh");c(this,"Rm");c(this,"Ih");c(this,"skeletons");c(this,"lt");c(this,"_r");c(this,"js");c(this,"ho");c(this,"Hs");c(this,"se");c(this,"Rr");c(this,"downAt");c(this,"Mh");c(this,"handler");c(this,"toolkitDragObject");c(this,"ks");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"Vh");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"Lm");c(this,"wm");c(this,"Gh");c(this,"xt",!1);c(this,"$h",!1);c(this,"Ws",!1);c(this,"$handleOffset");c(this,"Bh");c(this,"Fh");c(this,"bt");c(this,"Uh");c(this,"sn");c(this,"ve");c(this,"ht");c(this,"Nm");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"Im");c(this,"Mm")}Dm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.xt=e,this.Dm(e)}set $rotating(e){this.$h=e,this.Dm(e)}get $busy(){return this.xt||this.$h}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||DC,this.Bh=t.modelUpdater,this.Fh=t.handlerFactory,this.Im=ew(this),this.Mm=tw(this),e.$addTransferrableVertexAttributes([by,xy,yy,Ay]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:LC,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:wC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.wm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.bt=t.handleSize||kp,this.Uh=t.handleShape||"circle",this.sn=t.rotateLeaderLength||_C,this.ve=t.rotateHandleSize||OC,this.ht=t.borderHandleSize||RC,this.resizeMethod=t.resizeMethod||Vh,this.bordersVisible=this.resizeMethod===NC&&t.bordersVisible!==!1,this.Lm=t.rotatable===!0,this.Gh=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[St,Gh,Wp,is].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.Nm=t.payloadGenerator||((a,l)=>l),this.instance.bind(rr,()=>{this.reset()}),this.instance.bind(Jt,a=>{this.onDemand!==!0&&this.zh(a.obj)}),this.instance.bind(Kt,a=>{this.onDemand!==!0&&this.jn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(nr,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Ve,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(Oe,a=>{n(a.vertex)}),this.instance.bind(Re,a=>{this.jn(a.node)}),this.instance.bind(Me,a=>{this.jn(a.group),a.group.getMembers().forEach(l=>this.jn(l))});let o=a=>{this.xt||this.instance.openTransaction(),this.$moving=!0,he(a);let l=this.surface.mapEventLocation(a);this.$h?this.Hx(l):this.kx(l)},s=a=>{if(this.$busy){if(he(a),this.Ws&&this.lt!=null){let l=new Set;if(this.se!=null){let h={},d={},u={},{movedElements:p,resizedGroups:m}=this.se.Wl();Object.assign(u,m);for(let g in p)h[g]=p[g].current,d[g]=p[g].current;for(let g in h){let E={[this.surface.$modelLeftAttribute]:h[g].x,[this.surface.$modelTopAttribute]:h[g].y};u[g]!=null&&(E[this.surface.$modelWidthAttribute]=u[g].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[g].newGroupSize.height),this.surface.model.$_updateVertex(g,E,$s,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let g in u){let E=u[g].newGroupSize;this.surface.viewport.updateElement(g,null,null,E.width,E.height,null,null,!1)}}else l.add(this.lt);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.ks&&F(this.ks,hy),this.surface.$removeClassFromElement(document.body,gt),this.surface.off(document,oe,o),this.surface.off(document,se,s),this.se&&this.se.cleanup(),this.se=null,this.lt=null,this.js=!1,this.ho=null,this.Hs=null,this._r=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.Ws=!1}};return this.surface.on(this.surface.getContainer(),pe,z(St),a=>{this.Vm(a,this.Im,o,s)}),this.surface.on(this.surface.getContainer(),pe,z(is),a=>{this.Vm(a,this.Mm,o,s)}),this.surface.on(this.surface.getContainer(),pe,z(Gh),a=>{he(a),this.Or=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(te)),this.toolkitDragObject!=null&&(this.Rr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Or=this.Rr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.Vh={x:this.Rr.c.x,y:this.Rr.c.y},this.Gm(a),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,oe,o),this.surface.on(document,se,s))}),!1}Gm(e){this.toolkitDragObject!=null&&(this.lt=this.toolkitDragObject.group,this.js=!1,this.lt!=null&&(this.ho=this.surface.getGroupDefinition(this.lt),this.Hs=this.surface.$_getGroupContentAreaInfo(this.lt.id),this._r=this.surface.viewport.getGroupElement(this.lt.id),this.js=this.ho.elastic===!0&&e.shiftKey!==!0,this.js&&(this.se=new ya(this.surface,this.toolkitDragObject,this.lt,this.ho))))}Vm(e,t,n,o){he(e);let s=e.target,a=s.getAttribute(te);this.nn=s.getAttribute(va),this.ks=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.Rr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Gm(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Wx(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Or=this.$m(),this.lo={x:l.x,y:l.y},this.Ih={width:l.width,height:l.height},this.Dh=this.$x2-this.$x1,this.Nh=this.$y2-this.$y1,this.Rm={x:this.$x1+this.Dh/2,y:this.$y1+this.Nh/2},this.Mh=jC(this.downAt.x,this.downAt.y,this.Or,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),Y(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.wm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),m=p.xmax+u.internalOffset.x,g=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,m),this.currentMinimumHeight=Math.max(this.minimumHeight,g)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=ae({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.nn]),this.Fh!=null){let h=this.Fh(this.surface,this.toolkitDragObject,this.nn,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.ks,hy),this.surface.$addClassToElement(document.body,gt),this.surface.on(document,oe,n),this.surface.on(document,se,o)}$m(){if(this.Rr==null)return 0;{let t=(this.Rr.r==null?0:this.Rr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Zx(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.$m();return t?XC(e.x,e.y,o,n):jC(e.x,e.y,o,n)}Wx(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.Jx();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}Zs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}jn(e){this.Zs(e.id)}zh(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.jn(e),Y(t.modelObject)&&t.collapsed||En(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(yy)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(xy)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(by)===ct||!o&&!s)return;this.Yh(t,e,o,s)}}Yh(e,t,n,o){let s=e,a=this.resizeMethod==Vh?[IC]:[MC];this.bordersVisible&&a.push(VC);let l=Ie(q,a,null,{transform:`translate(${e.x}, ${e.y})`,[te]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ie(Z,[GC],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(Ay)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.Lm,m=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===Vh){if(p){m.rl=Ie(ee,[Wp],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.sn+this.$handleOffset}`,"stroke-width":2}),m.rh=G(q,{transform:`translate(${s.width/2-this.ve/2}, ${-this.sn-this.$handleOffset-this.ve/2})`}),l.appendChild(m.rh),Ie(He,[Gh],m.rh,{[te]:t.id,cx:this.ve/2,cy:this.ve/2,r:this.ve/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let g=G(Qe,{x:`${this.ve/2}`,y:`${this.ve/2}`,"font-size":Math.floor(this.ve*.75)});g.innerHTML="\u21BA",m.rh.appendChild(g)}u&&(m.handles=this.Uh==="rectangle"?YC(this.bt,s,t,d,l,this.$handleOffset,n,o):zC(this.bt,s,t,d,l,this.$handleOffset,n,o))}else p&&(m.rl=Ie(ee,[Wp],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.sn+this.$handleOffset}`,"stroke-width":2}),m.rh=G(q,{transform:`translate(${s.width/2-this.ve/2}, ${-this.sn-this.$handleOffset-this.ve/2})`}),l.appendChild(m.rh),Ie(He,[Gh],m.rh,{[te]:t.id,cx:this.ve/2,cy:this.ve/2,r:this.ve/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),m.borders={t:null,b:null,l:null,r:null},u&&(o&&(m.borders.t=Ie(Z,[is,BC],l,{[va]:"t",[te]:t.id,width:s.width,height:this.ht,x:0,y:-this.ht/2}),m.borders.b=Ie(Z,[is,$C],l,{[va]:"b",[te]:t.id,width:s.width,height:this.ht,x:0,y:s.height-this.ht/2})),n&&(m.borders.r=Ie(Z,[is,UC],l,{[va]:"r",[te]:t.id,width:this.ht,height:s.height,x:s.width-this.ht/2,y:0}),m.borders.l=Ie(Z,[is,FC],l,{[va]:"l",[te]:t.id,width:this.ht,height:s.height,x:-(this.ht/2),y:0})));return Sy(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return Sy(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.ve/2}, ${-this.sn-this.$handleOffset-this.ve/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.sn+this.$handleOffset}`),!0}return!1}Kx(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}Hx(e){let t=e.x-this.Vh.x,n=e.y-this.Vh.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Gh!=null){let s=360/this.Gh;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Vs,!1),this.Or=o}kx(e){let t,n,o=this.Zx(e);if(t=o.x-this.Mh.x,n=o.y-this.Mh.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.nn==="l"||this.nn==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.nn==="t"||this.nn==="b")&&(t=0),this.Ws||t!=0||n!=0){this.Ws=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.lt!=null&&(this.se!=null?this.se.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.ho.constrain&&(s+l>this._r.width&&(l=this._r.width-s),a+h>this._r.height&&(h=this._r.height-a)))),this.Bm(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.Dh,y:this.$y1+this.handler.anchor[1]*this.Nh},p=XC(u.x,u.y,this.Or,this.Rm),m={x:s+l/2,y:a+h/2},g={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=XC(g.x,g.y,this.Or,m),y=E.x-p.x,x=E.y-p.y,f={x:m.x-y,y:m.y-x},b=jC(p.x,p.y,this.Or,f);this.lo={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Ih={width:l,height:h};let A=this.Kx(this.lo.x,this.lo.y,l,h),T=this.Nm(this.toolkitDragObject,A)||{},S=Object.assign(T,A),R;if(this.Bh!=null&&(R=this.Bh(this.toolkitDragObject,this.lo,this.Ih)),this.instance.$_updateVertex(this.toolkitDragObject,S,Al,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],Al,!1);if(R!=null)for(let v in R)this.instance.$_updateVertex(v,R[v],Al,!1)}}Jx(){return this.lt==null?{x:0,y:0}:{x:this._r.x+this.Hs.internalOffset.x,y:this._r.y+this.Hs.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Zs(e.id),setTimeout(()=>{this.zh(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==Al&&this.skeletons[e.id]!=null&&(this.Zs(e.id),setTimeout(()=>{this.zh(e.modelObject)}))}Bm(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(de(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===Vh?this.Uh==="rectangle"?(o.handles.tr&&de(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&de(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&de(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&de(o.handles.t,{x:e/2}),o.handles.b&&de(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&de(o.handles.l,{y:t/2}),o.handles.r&&de(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&de(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&de(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&de(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&de(o.handles.t,{cx:e/2}),o.handles.b&&de(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&de(o.handles.l,{cy:t/2}),o.handles.r&&de(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&de(o.borders.t,{width:e}),o.borders.b&&de(o.borders.b,{width:e,y:t-this.ht/2}),o.borders.r&&de(o.borders.r,{height:t,x:e-this.ht/2}),o.borders.l&&de(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.Bm(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.jn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{Xe(n.mel.modelObject,e.modelObject)&&this.Zs(n.mel.id)})}};c(ss,"type","resizingTools"),ss=Je([We("resizingTools")],ss);var HC=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(HC||{}),Jp="state",Zp=class extends Gt{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===vt?"paused":"playing"}setState(e){this.state=e,this.fire(Jp,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var $h="startOverlayAnimation",to="endOverlayAnimation",Ty="startNodeTraversal",kC="endNodeTraversal",vy="vjs-animate-source",Cy="vjs-animate-target",Un="vjs-animate-node-traversing",Bh="vjs-animate-edge-traversing",pG="vjs-animate-node-traversable",Kp="vjs-animate-edge-traversable",mG="vjs-animate-node-traversed",Py="vjs-animate-edge-traversed";var WC="INITIALIZED",_y="TRAVERSING_START",ZC="TRAVERSING_EDGE",Oy="TRAVERSING_END",Ca="CANCELLED",Pa="FINISHED";function rw(i,r,e,t){let n=new Gt,o=r.connector.totalLength;t=t||{};let s=$(),a=t.events||{};for(let V in a)n.bind(V,a[V]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,m=o/p*1e3,g=m/d,E=1/g*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,R=h?r.targetElement:r.sourceElement,v,_=t.paused===!0,P=!1,I=!1,C=WC;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let O=V=>{I=!1,Fo(r,s),window.clearInterval(b),y?V?(C=Ca,i.surface.removeClass(S,Un),i.surface.removeClass(R,Un),Pr(r,Bh)):(C=Oy,i.surface.addClass(R,Un),window.setTimeout(function(){M()},u)):(i.surface.removeClass(S,Un),i.surface.removeClass(R,Un),Pr(r,Bh),V?C=Ca:(C=Pa,Hr(r,Py),n.fire(to,{connection:r,harness:l})))},w=()=>{f+=E,T()?O(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},B=()=>{C=ZC,n.fire($h,{connection:r,harness:l}),A=Ul(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==Pa&&C!==Ca&&(i.surface.removeClass(S,Un),n.fire(kC,{connection:r,element:S,harness:l}),B())},M=()=>{!I&&C!==Pa&&C!==Ca&&(C=Pa,i.surface.removeClass(S,Un),i.surface.removeClass(R,Un),Pr(r,Bh),n.fire(to,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(Ty,{connection:r,element:S,harness:l}),i.surface.addClass(S,Un),Hr(r,Bh),C=_y,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===_y?N():C===Oy?M():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==Pa&&C!==Ca&&(window.clearInterval(b),O(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(to,D):_||D(),l}var qp=class extends Gt{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=sd(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=sd(o.step,()=>{}),o.complete=sd(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,m=u/d*l,g=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+m*(E+1),a.y+g*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=X(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Hr(n,Kp),rw(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[to]:()=>e.complete&&e.complete(),[$h]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(m,g)=>{this.fire(m,{edge:g.edge,connection:g,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,vy),this.surface.addClass(u,Cy),t.eachEdge((m,g)=>{Hr(this.surface.$_connMap[g.id],Kp)});for(let m=1;m<l;m++){let g=t.result.path[m].vertex.id,E=t.result.previous[g],y=!0,x=t.result.path[m].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=rw(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:m===l-1,forwards:y,paused:!0,events:{[Ty]:f=>{h.currentlyAnimatingConnection=f.harness},[to]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((m,g)=>{let E=this.surface.$_connMap[g.id];Pr(E,[Py,Kp].join(" "))}),this.surface.removeClass(d,vy),this.surface.removeClass(u,Cy),n(to,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind($h,()=>{n($h,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(to,p),h=new Zp(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(Jp,e.listener),h.fire(Jp,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var Qp="vjs-shape-library-palette-set",Ry="vjs-shape-library-palette",Fh="vjs-shape-library-palette-filter",Uh="vjs-shape-library-palette-shape",Ly="vjs-shape-library-palette-label",JC="vjs-shape-library-palette-set-title",wy="vjs-shape-library-palette-set-shapes",KC="vjs-shape-library-palette-lasso";var gG=150,EG=100,fG="data-visible",ro="data-category",em="data-shape-id",qC="data-show-all",QC="data-vjs-type",yG="shape-icon",nw="mainTemplate",iw="preparedTemplate",eP="setTemplate",_a="__vjsALL";function xG(i="Show all"){return{[eP]:`<div class="${Qp}" data-category="{{id}}">
|
|
103
|
+
<div class="${JC}" data-category="{{id}}">{{name}}</div>
|
|
104
|
+
<div class="${wy}" data-category="{{id}}">
|
|
105
105
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
106
106
|
</div>
|
|
107
107
|
<r-if test="children.length > 0">
|
|
108
|
-
<select class="${
|
|
109
|
-
<option value="${
|
|
108
|
+
<select class="${Fh}" data-category="{{id}}" data-show-all="true">
|
|
109
|
+
<option value="${_a}">${i}</option>
|
|
110
110
|
<r-each in="children">
|
|
111
111
|
<option value="{{id}}">{{name}}</option>
|
|
112
112
|
</r-each>
|
|
113
113
|
</select>
|
|
114
114
|
<r-each in="children">
|
|
115
|
-
<r-tmpl id="${
|
|
115
|
+
<r-tmpl id="${eP}"/>
|
|
116
116
|
</r-each>
|
|
117
117
|
</r-if>
|
|
118
|
-
</div>`,[
|
|
119
|
-
<div class="${
|
|
118
|
+
</div>`,[iw]:`<div class="${Ry}">
|
|
119
|
+
<div class="${wy}">
|
|
120
120
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
121
121
|
</div>
|
|
122
|
-
</div>`,[
|
|
122
|
+
</div>`,[nw]:`<div class="${Ry}" data-show-all="{{showAll}}">
|
|
123
123
|
<r-if test="sets.length > 1">
|
|
124
|
-
<select class="${
|
|
125
|
-
<option value="${
|
|
124
|
+
<select class="${Fh}" data-category="${qi}" data-show-all="{{showAll}}">
|
|
125
|
+
<option value="${_a}">${i}</option>
|
|
126
126
|
<r-each in="sets">
|
|
127
127
|
<option value="{{id}}">{{name}}</option>
|
|
128
128
|
</r-each>
|
|
129
129
|
</select>
|
|
130
130
|
</r-if>
|
|
131
131
|
<r-each in="sets">
|
|
132
|
-
<r-tmpl id="${
|
|
132
|
+
<r-tmpl id="${eP}"/>
|
|
133
133
|
</r-each>
|
|
134
|
-
</div>`}}var eG=1.25,Zp=class{constructor(r,e){this.ui=r;c(this,"Bn");c(this,"Nx");c(this,"Dc");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||eG,o=e.iconSize||{width:Z1,height:J1};this.onVertexAdded=e.onVertexAdded,this.Dc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||ku.FILL,a=e.outline||ku.STROKE,l=e.outlineWidth||ku.STROKE_WIDTH;this.Bn=fr({templates:Q1(e.showAllMessage)});let h=`<div class="${$h}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${vy}">{{label}}</div>`:"")+"</div>";this.Bn.registerTag(q1,{template:h,rendered:(p,g,m,E)=>{var T,S,R;let y=g.type,x=null,f=E.getAttribute(Qi)||g.category;f!=null&&p.setAttribute(Qi,f);let b=g.shapeId;b!=null&&(p.setAttribute(Wp,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",g.label||""),g.objectType===ie.objectType&&p.setAttribute(Yl,Tt);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===ie.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},O=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((R=A.initialSize)==null?void 0:R.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${O} ${P}`),A.icon){let C=this.Bn.parse(A.icon),_=this.Bn.render(C,v).fragment;I.appendChild(_)}else{let C=Ng(dn({},v),{type:y,category:f,width:O,height:P}),_=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(O,P),M=(O-N)/2,D=(P-N)/2;_.setAttribute("transform",`translate(${M}, ${D})`)}I.appendChild(_);let $={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let M in N){let D=M===ph?"stroke":M===gh?"stroke-width":M;I.setAttribute(D,N[M]),delete $[D]}}for(let N in $)I.setAttribute(N,$[N])}}},updated:(p,g,m)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(g=>Object.assign({},this.$shapeLibrary.getShapeDefinition(g.type,g.category),{shapeId:g.shapeId,properties:g.properties,category:g.category,label:g.label,size:g.size}));this.$preparedShapes=p,d=this.Bn.template(B0,{shapes:p})}else d=this.Bn.template($0,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.Nx=new Aa(r,{source:this.palette,selector:Y($h),dragSize:e.dragSize,dragSizeGenerator:(p,g)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:MC,elementGenerator:(p,g)=>{let m=p.cloneNode(!0),E=m.querySelector(Y(vy));return E&&E.parentNode.removeChild(E),m},vertexPreviewGenerator:(p,g,m,E,y)=>{let x=Object.assign(m,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:m.outlineWidth||1}),f=B(Pe,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(ch);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,g,m,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:m.width,[r.$modelHeightAttribute]:m.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`)},dataGenerator:p=>{var C,_,w,$,N;let g=this.Dc?this.Dc(p)||{}:{},m=p.getAttribute(GC),E=p.getAttribute(Qi),y=p.getAttribute(Wp),x=this.$shapeLibrary.getShapeDefinition(m,E),f=g.fill,b=g.outline,A=g.outlineWidth,T=g.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),R=(S==null?void 0:S.properties)||{},v=(_=S==null?void 0:S.size)==null?void 0:_.width,O=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||g.width||(($=x.initialSize)==null?void 0:$.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=O||g.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(g,{type:m,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},R),f!=null&&(g.fill=f),b!=null&&(g.outline=b),A!=null&&(g.outlineWidth=A),T!=null&&(g.color=T),x.payload&&Object.assign(g,x.payload),g},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(Y(Gh))).forEach(p=>{p.addEventListener("change",g=>{let m=p.options[p.selectedIndex].value,E=p.getAttribute(Qi);p.setAttribute(VC,`${m===Ca}`),this.Am(m,E)})}),e.inspector!==!1){r.model.bind(ar,m=>{g()}),r.model.bind(lr,m=>{g()});let p=()=>{Array.from(this.palette.querySelectorAll(Y(Hu))).forEach(E=>{F(E,Hu)})},g=()=>{p();let m=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>m.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),m.size===1){let[E,y]=Array.from(m)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${Qi}='${y}'][${GC}='${E}']`);f!=null&&L(f,Hu)}}};r.model.bind(vr,()=>{p()}),r.on(this.palette,W,Y($h),m=>{let E=m.target.closest(Y($h)),y=E.getAttribute(Qi),x=E.getAttribute(GC),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||de.objectType,A=this.Sm();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Me,_e],m=>{this.Sm().containsVertex(m.vertex.id)&&g()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}Sm(){return this.ui.model.getSelection().filter(r=>K(r)||z(r))}Ix(r){return this.palette.querySelector(`${Y(Gh)}[${Qi}='${r}']`)}Am(r,e){let t=e==Wi?this.palette:this.palette.querySelector(`${Y(kp)}[${Qi}='${e}']`);t.setAttribute(VC,`${r==Ca}`),Array.from(t.querySelectorAll(Y(kp))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(K1,`${r===Ca||r===o.getAttribute(Qi)}`)})}Tm(r,e){this.Am(r,e);let t=this.Ix(e);t!=null&&(t.value=r,t.setAttribute(VC,`${r===Ca}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==Wi;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.Tm(o[0],o[1])})}}else this.Tm(Ca,Wi)}};var Py="vjs-diagram-node",Oy="vjs-diagram-group",BC=100,FC=80,UC=[hv];var Fn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[wf]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[ph]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[gh]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Df]:r})}get label(){return this.vertex.data[ki]}get fill(){return this.vertex.data[wf]||mh}get outline(){return this.vertex.data[ph]||ko}get outlineWidth(){return this.vertex.data[gh]||Eh}get color(){return this.vertex.data[Df]||lv}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var di=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof Fn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Fn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function zC(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:ga.type}}var F0=15,_y="vjs-cell-tool",YC="vjs-clone-cell",XC="vjs-delete-cell",U0="vjs-link-cell",os=class extends is{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||F0,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.ft/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,Y(YC),n=>{let s=n.target.closest(`[${ee}]`).getAttribute(ee);s!=null&&(le(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,Y(XC),n=>{let o=n.target.closest(`[${ee}]`),s=o.getAttribute(ee);if(s!=null){le(n);let a=this.surface.model.getVertex(s);z(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}wc(e,t,n,o){let s=super.wc(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=B(q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),Qu(Ju,this.$buttonSize,this.$buttonSize,[YC,_y],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=B(q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),Qu(Ku,this.$buttonSize,this.$buttonSize,[XC,_y],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=B(q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),Qu(Zu,this.$buttonSize,this.$buttonSize,[U0,_y],{title:"Click and drag to link","data-vjs-source":!0,[ee]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(ai,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(ai,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(ai,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(os,"type","diagramTools"),os=Ze([ke("diagramTools")],os);var Bh=class extends Zp{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(Wp);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function jC(i){return i.startEditingPath!==void 0}function z0(i){return i.isEmpty()?0:i.head().zIndex}function tG(i){return i.isEmpty()?0:i.peek().zIndex}var Jp=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"G");var a,l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,R,v,O,P,I,C,_,w,$,N,M,D,V,J,ye,j,me,Ge,je,Ut,rr,qt,wr,ao,Xa,ja,Ha,ka,Wa,Lg,wg,dc,Dg,uc,ds;t=t||{},this.G=t.mediator,this.$_cellList=new gs((ne,Ue)=>ne.zIndex<Ue.zIndex?-1:ne.zIndex>Ue.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||ki,this.$shapeLibrary=new ra(t.shapes||UC,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new Su(this.model,{fill:t.defaultFillColor||mh,outline:t.defaultOutlineColor||ko,outlineWidth:t.defaultOutlineWidth||Eh,color:t.defaultColor||ko}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||BC,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||FC,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:os.type,options:{rotationStops:(g=t.cells)==null?void 0:g.rotationStops,canResizeFilter:(ne,Ue)=>{var Lt,Sr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Sr=t.cells)==null?void 0:Sr.resizable)!==!1&&this.Mx(ne,Ue)!==!1},canRotateFilter:(ne,Ue)=>{var Lt,Sr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Sr=t.cells)==null?void 0:Sr.rotatable)!==!1&&this.Vx(ne,Ue)!==!1},canShowLinkButton:(ne,Ue)=>{var Lt,Sr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Sr=t.cells)==null?void 0:Sr.linkable)!==!1&&this.Gx(ne,Ue)!==!1},canDelete:(ne,Ue)=>{var Lt,Sr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Sr=t.cells)==null?void 0:Sr.deletable)!==!1&&this.$x(ne,Ue)!==!1},canClone:(ne,Ue)=>{var Lt,Sr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Sr=t.cells)==null?void 0:Sr.clonable)!==!1&&this.Bx(ne,Ue)!==!1},handleShape:(E=(m=t.cells)==null?void 0:m.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(R=t.cells)==null?void 0:R.resize)==null?void 0:v.method,bordersVisible:(P=(O=t.cells)==null?void 0:O.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(_=t.cells)==null?void 0:_.resize)==null?void 0:w.resizeX,resizeY:(N=($=t.cells)==null?void 0:$.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let ne=t.snapLines===!0?{}:t.snapLines;n.push({type:es.type,options:ne})}if(t.panButtons!=null){let ne=t.panButtons===!0?{}:t.panButtons;n.push({type:ts.type,options:ne})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:Ko.type,options:zC()}),t.lasso!=null&&(lo(t.lasso)?n.push(Vn.type):n.push({type:Vn.type,options:t.lasso})),t.miniview!=null&&n.push({type:Gn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:Qo.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)!==!1&&n.push({type:ma.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:(V=t.edges)==null?void 0:V.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(J=t.cells)==null?void 0:J.magnetizer,getCollapsedGroupSize:(ye=t.cells)==null?void 0:ye.getCollapsedGroupSize,canCollapseGroup:(ne,Ue)=>this.G!=null&&this.G.canCollapse!=null?this.G.canCollapse(ne,Ue):!0,canExpandGroup:(ne,Ue)=>this.G!=null&&this.G.canExpand!=null?this.G.canExpand(ne,Ue):!0,elementsDraggable:this.$editable!==!1&&((j=t.cells)==null?void 0:j.draggable)!==!1,defaults:o,view:this.Fx(t),shapes:{library:this.$shapeLibrary,showLabels:((me=t.cells)==null?void 0:me.showLabels)!==!1,strokeWidth:(Ge=t.cells)==null?void 0:Ge.outlineWidth,labelAttribute:(je=t.cells)==null?void 0:je.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Ut=t.cells)==null?void 0:Ut.font},edges:{editable:t.editable!==!1&&((rr=t.edges)==null?void 0:rr.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(qt=t.edges)==null?void 0:qt.propertyMappings,avoidVertices:(wr=t.edges)==null?void 0:wr.avoidVertices,allowUnattached:((ao=t.edges)==null?void 0:ao.allowUnattached)!==!1,connector:(Xa=t.edges)==null?void 0:Xa.connector,layerIndex:(ja=t.edges)==null?void 0:ja.layerIndex,sourceMarker:(Ha=t.edges)==null?void 0:Ha.sourceMarker,targetMarker:(ka=t.edges)==null?void 0:ka.targetMarker,overlays:(Wa=t.edges)==null?void 0:Wa.overlays,anchor:(Lg=t.edges)==null?void 0:Lg.anchor,anchors:(wg=t.edges)==null?void 0:wg.anchors,inputMethod:(dc=t.edges)==null?void 0:dc.inputMethod,reattach:((Dg=t.edges)==null?void 0:Dg.reattach)===!0,detachable:(uc=t.edges)==null?void 0:uc.detachable},edgeSnap:(ds=t.edges)==null?void 0:ds.snap,plugins:n,events:{[yo]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Ps]:ne=>{if(this.$editable){let Ue=this.$_cellMap.get(ne.dragGroup[0].vertex.id);Ue!=null&&this.toFront(Ue)}},[ib]:ne=>{if(this.$editable){let Ue=this.$_cellMap.get(ne.dragGroup[0].vertex.id);Ue!=null&&this.toFront(Ue)}}},dragOptions:{filter:ne=>this.G&&this.G.canDrag?this.G.canDrag(ne.vertex,this.Cr(ne.vertex),ne.el):!0,canDrop:(ne,Ue,Lt)=>this.G&&this.G.canDrop?this.G.canDrop(ne,Ue,Lt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${No}="${this.$editable}" class="${Py}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${No}="${this.$editable}" class="${Oy}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${Oy}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${Py}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind($r,ne=>{this.vm(ne.vertex,ne.el)}),this.$ui.bind(Gr,ne=>{this.vm(ne.vertex,ne.el)}),this.model.bind(Re,ne=>{this.Cm(ne.node)}),this.model.bind(Ie,ne=>{this.Cm(ne.group)}),this.model.bind(Ht,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}Fx(r){var h,d,u,p,g,m,E,y,x,f,b,A,T,S,R;let e=(h=r.edges)!=null&&h.events?r.edges.events[Fe]:null,t={events:{[Fe]:v=>{let O=v.e.srcElement||v.e.target;if(nn(O,Zs)){le(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().q.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(g=r.edges)==null?void 0:g.deleteButton,deleteButtonClass:(m=r.edges)==null?void 0:m.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==Fe&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>O=>{this.$editable&&this.toFront(this.$_cellMap.get(O.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||O.model.getSelection().ae.length<1||O.e.shiftKey!==!0?O.model.setSelection(O.obj):O.model.addToSelection(O.obj)),v&&v(O)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,O,P,I)=>{let C=this.Cr(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,O,P,I)=>{let C=this.Cr(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(R=r.cells)==null?void 0:R.nodes,O=v.events||{};O.tap&&(O.tap=o(O.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}vm(r,e){r.data.z==null&&(r.data.z=z0(this.$_cellList)+1);let t=new Fn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}Cm(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Vx(r,e){let t=this.Cr(r);return t==null?!0:this.G&&this.G.canRotate?this.G.canRotate(r,t,e):!0}Gx(r,e){let t=this.Cr(r);return t==null?!0:this.G&&this.G.canLink?this.G.canLink(r,t,e):!0}Bx(r,e){let t=this.Cr(r);return t==null?!0:this.G&&this.G.canClone?this.G.canClone(r,t,e):!0}Mx(r,e){let t=this.Cr(r);return t==null?!0:this.G&&this.G.canResize?this.G.canResize(r,t,e):!0}$x(r,e){let t=this.Cr(r);return t==null?!0:this.G&&this.G.canDelete?this.G.canDelete(r,t,e):!0}Cr(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}Ux(r){return X(r)?r:r.id}Nc(r){return X(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new Fn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new di(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Fn&&(e.source=e.source.id),e.target instanceof Fn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new di(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return xa(this.$ui,r).svg}exportImage(r,e){Lp(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.Ux(r))}toFront(r){if(!(r instanceof di)){let e=this.Nc(r),t=z0(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}toBack(r){if(!(r instanceof di)){let e=this.Nc(r),t=tG(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}selectCell(r){let e=this.Nc(r);this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(X(r)?r:r.id);this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof di?r.edge:r;jC(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){jC(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(jC(this.$ui)){let e=r instanceof di?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Gn.type,options:r})}attachPalette(r,e){return new Bh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function rG(i,r,e){return new Bh(r,i,e)}function nG(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||ve,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||De,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||Q,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||Ee,selectionMode:td});let o=an(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var HC=class extends ba{constructor(r,e,t){super(r,e.$ui,t)}};function iG(i,r){cp.register(i,r)}function oG(i,r,e){return an(e||{}).render(i,r)}var sG=function(i,r,e){let t=i.srcElement||i.target;return!Gt(t,e||Y0,r)},aG=(e=>(e.idle="idle",e.dragging="dragging",e))(aG||{}),oC="assigned",Pa="added";function X0(i){return X(i)?{id:i,active:!0,membership:Pa}:{id:i.id,active:i.active,membership:i.membership}}var lG=Y(rh);function hG(i,r){let e=Bg(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var cG=["input","textarea","select","button","option"],Y0=cG.join(","),Kp=class{constructor(r){c(this,"inputFilterSelector");c(this,"Or",{});c(this,"Ic",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"Mc");c(this,"Oe");c(this,"Vc");c(this,"eo");c(this,"u");c(this,"_");c(this,"fe");c(this,"Pr");c(this,"Us");c(this,"Gc");c(this,"te");c(this,"zs",[]);c(this,"Ys");c(this,"no");c(this,"$t",[]);c(this,"currentState","idle");c(this,"he");c(this,"qr",{});c(this,"$c",{});c(this,"Bt",null);c(this,"Te",new Map);c(this,"io",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||Y0;let e=`${be(ee)}, ${be(ee)} *`;if(this.draggableInstance.addDragHandler({selector:e,start:t=>this.zx(t),drag:t=>this.Yx(t),stop:t=>{this.Xx(t)},constrainFunction:(t,n,o,s,a,l)=>t}),this.ui.bind(Kn,t=>{this.currentState==="dragging"&&(this.eo=this.eo*(t.zoom/this.Vc),this.Vc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&typeof IntersectionObserver!="undefined"){let t=this.draggableInstance.dragOptions.autoPanDelta||5,n=this.draggableInstance.dragOptions.autoPanRepeat||15;this.he=new IntersectionObserver((o,s)=>{this.Mc||o.forEach(a=>{if(a.isIntersecting)this.draggableInstance.$stopPanRepeat();else{let l=a.boundingClientRect.y<a.rootBounds.y?1:a.boundingClientRect.y+a.boundingClientRect.height>a.rootBounds.y+a.rootBounds.height?-1:0,h=a.boundingClientRect.x<a.rootBounds.x?1:a.boundingClientRect.x+a.boundingClientRect.width>a.rootBounds.x+a.rootBounds.width?-1:0;this.draggableInstance.$startPanRepeat(h,l,t,t,n,d=>{let u=this.draggableInstance.getEffectiveVisibleZoom();this.Oe.x+=d.x/u,this.Oe.y+=d.y/u,this.newPosition!=null&&this.Om(!1)})}})},{root:this.draggableInstance.$getDragViewportContainer(),rootMargin:"0px",threshold:.99})}}Bc(r){for(let e in this.Or){let t=this.Or[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&un(r)){r.oo=e||G();let n=r.oo;this.Or[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.oo:r;delete this.Or[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return Gt(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(St).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return nn(l,o)};s.jx=o,this.addDragFilter(s,t,e)})}))}kx(r){for(let e in this.Or)if(this.Or[e].jx===r){delete this.Or[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(St).forEach(n=>{this.kx(n)})}))}clearAllFilters(){this.Or={}}oe(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.te&&this.te.cleanup(),this.te=null,this.Gc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,gt),F(this.ui.rootElement,ff),this.no||(F(this.ui.rootElement,oh),F(this.ui.rootElement,mr),F(this.ui.rootElement,Er)),this._!=null&&F(this._.el,yf),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(lG)).forEach(r=>{F(r,rh)}),L(this.u.el,rh),F(this.u.el,th),this.Te.forEach(r=>{F(r.managedElement.el,th),L(r.managedElement.el,rh)})),this.currentState="idle",this.u=null,this._=null,this.Pm(),this.zs.forEach(r=>{this._m(r.managedElement,mr,Tf,oh)}),this.zs.length=0,this.io.clear(),this.Te.clear(),this.Bt=null}Pm(){this.$t.forEach(r=>{this._m(r.managedElement,Er)}),this.$t.length=0}Hx(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Rm(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}zx(r){if(r.e.Wx==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(gr)!==ct)if(this.Bc(r.e)&&sG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Zt(r.el,be(_t),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!tt(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.Te.clear(),this.Ys=!0,r.e.Wx=!0,this.u=this.Hx(t.obj,r.e),this.u==null)return r.e.Wf=!0,!1;this.Us=!1,this.fe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.Oe={x:0,y:0},this.Mc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this.Pr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Pr=this.ui.getGroupDefinition(this._.modelObject),this.Pr.elementsDraggable===!1)return!1;s=this.Pr.elastic===!0&&r.e.shiftKey!==!0,this.Gc=r.e.shiftKey===!0,this.fe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,yf),this.Ys=this.ui.$canDrop(this.u.modelObject,null,!0),this.Ys,s||(F(this.ui.rootElement,mr),L(this.ui.rootElement,oh))}this.no=o||s,this.no||L(this.ui.rootElement,mr),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!Ke(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),g=this.ui.$_getGroupContentAreaInfo(l.id),m={droppable:u,managedElement:p,depth:Tc(l),contentAreaInfo:g,contentArea:p.contentArea,contentBox:{x:p.x+g.internalOffset.x,y:p.y+g.internalOffset.y,width:p.width-g.internalOffset.x,height:p.height-g.internalOffset.y},isCurrentGroup:d,group:l,id:l.id};this.zs.push(m),u?(d||this.Fn(p,mr),d&&this.Fn(p,Tf)):this.Fn(p,oh)}}):s&&(this.te=new Ea(this.ui,this.u.modelObject,this.u.modelObject.group,this.Pr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.Zx(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.Vc=this.draggableInstance.getZoom(),this.eo=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,gt),L(this.ui.rootElement,ff),L(this.u.el,th),this.currentState="dragging",this.he&&this.he.observe(this.u.el),this.Bt=this.qr[this.u.modelObject.id],this.Bt&&!hG(this.Bt,this.u.modelObject.id)&&(this.Bt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.io.clear(),this.Te.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:Xn(this.u),originalPosition:Dt(this.u),position:Dt(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Bt!=null){let l=(z(this.u.modelObject)?fs(this.u.modelObject):[]).map(d=>d.id),h=gn(this.u.modelObject).map(d=>d.id);Array.from(this.Bt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.Te.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:Xn(d.el),originalPosition:Dt(d.el),position:Dt(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.he&&this.he.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,th),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Ps,a),!0}else return!1;else return!1}else return!1;else return!1}}Jx(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.he!=null&&(this.he.unobserve(this.u.el),this.Te&&this.Te.forEach(r=>{this.he.unobserve(r.managedElement.el)}))}Fn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}_m(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}Xx(r){var e;if(this.Jx(),this.u!=null&&this.newPosition!=null){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.Oe.x,y:this.newPosition.y-this.Oe.y},d=Object.assign({},h);if(this.$t.length>0&&(o=this.$t[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.Gc&&t.delete(o.group))),o==null){if(!this.Ys)return this.Lm();this._!=null&&this.te==null&&(d.x+=this._.x+this.fe.internalOffset.x,d.y+=this._.y+this.fe.internalOffset.y),n[this.u.id]={x:d.x,y:d.y},Array.from(this.Te.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.Lm();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let g=d.x+(this._.x+this.fe.internalOffset.x),m=d.y+(this._.y+this.fe.internalOffset.y);d.x=g-(o.managedElement.x+p.internalOffset.x),d.y=m-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d.x-=o.managedElement.x+p.internalOffset.x,d.y-=o.managedElement.y+p.internalOffset.y,n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.Bt!=null){let g=this.Kx(d,o.managedElement,p);for(let m in g.current){let E={x:Math.floor(g.current[m].x),y:Math.floor(g.current[m].y)};n[m]=E;let y=this.Te.get(m),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.io.forEach((p,g)=>{n[g]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let g in p.current)n[g]=p.current[g]}this.ui.model.transaction(()=>{if(a)this.Te.forEach((p,g)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},g={};if(o==null)if(this.te==null)Array.from(this.Te.values()).forEach(m=>{m.parentGroup!=null&&(t.add(m.parentGroup.modelObject),this.ui.model.$removeFromGroup(m.modelObject,null,{x:this.relativePositionAtDown.x+m.offset.x,y:this.relativePositionAtDown.y+m.offset.y},m.position,this.ui))});else{let{movedElements:m,resizedGroups:E}=this.te.Gl();Object.assign(g,E);for(let y in m)n[y]=m[y].current,p[y]=m[y].current}else l.forEach(m=>{this.ui.model.$addToGroup(m.vertex,o.group,m.originalParent,m.originalPosition,m.positionInGroup,this.ui)});for(let m in n){let E={[this.ui.$modelLeftAttribute]:n[m].x,[this.ui.$modelTopAttribute]:n[m].y};g[m]!=null&&(E[this.ui.$modelWidthAttribute]=g[m].newGroupSize.width,E[this.ui.$modelHeightAttribute]=g[m].newGroupSize.height),this.ui.model.$_updateVertex(m,E,Vs,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(g)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.Te.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let g=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:g.el,vertex:p.modelObject,element:g})}}),this.ui.$stopMotion(),this.ui.fire(It,u)}this.oe()}Kx(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Bt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.Te.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.Te.get(h.id).size;return new Ti({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}Lm(){this.ui.$stopMotion(),Array.from(this.Te.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.io.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(Qc),this.oe()}qx(r){return this._==null||r.id===this._.id}Om(r){let e={x:this.newPosition.x-this.Oe.x,y:this.newPosition.y-this.Oe.y};this.Pm();let t={x:e.x+this.fe.pageOrigin.x,y:e.y+this.fe.pageOrigin.y,width:this.u.width,height:this.u.height};if(this.zs.forEach(l=>{Je(l.contentBox,t)&&this.$t.push(l)}),this.$t.length>0){this.$t.sort((h,d)=>h.depth>d.depth?-1:1);let l=!this.qx(this.$t[0].managedElement);(this._==null||this.Us||l)&&this.Fn(this.$t[0].managedElement,Er),this._!=null&&!l&&(this.Us=!0,this.Fn(this._,mr)),this.no||F(this.ui.rootElement,Er)}else this._!=null&&!this.Pr.elastic&&(this.Us=!0,this.Fn(this._,mr)),this.no||L(this.ui.rootElement,Er);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.Te.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=ae(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.Oe.x,y:this.newPosition.y-this.Oe.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.io.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.fe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(er,s),{redrawResult:a,positions:n}}Yx(r){if(this.currentState==="dragging"){le(r.e),this.Mc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.eo,n=(e.y-this.downAt.y)/this.eo,o={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(o.x-=this.fe.pageOrigin.x,o.y-=this.fe.pageOrigin.y,!this.Pr.elastic&&this.Pr.constrain&&(o.x+this.u.width>this._.width-this.fe.internalOffset.x&&(o.x=this._.width-this.u.width-this.fe.internalOffset.x),o.y+this.u.height>this._.height-this.fe.internalOffset.y&&(o.y=this._.height-this.u.height-this.fe.internalOffset.y),o.x<0&&(o.x=0),o.y<0&&(o.y=0))),this.activeGrid!=null&&(o=ae(o,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(o=this.draggableInstance.dragOptions.constrainFunction(o,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=o;let s=this.Om(r.e.shiftKey);return this.te!=null&&this.te.focusVertex.id===this.u.id&&this.Qx(r.e,s.positions[this.u.id]),s.redrawResult}else return null}Zx(){let r=this._?this._.x+this.fe.internalOffset.x:0,e=this._?this._.y+this.fe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}wm(r,...e){let t=[],n=X0(r),o=this.$c[n.id];if(o==null)o={id:n.id,members:new Set},this.$c[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Pa)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Rm(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.qr[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.qr[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.qr[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.qr[t.id];if(n!=null){let o=Bg(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.$c[r];e!=null&&(e.members.forEach(t=>{delete this.qr[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.qr[r]}Qx(r,e){this.te!=null&&e!=null&&this.te.setFocusPosition(e,!0,r)}Rm(r,e){for(let t=0;t<this.Ic.length;t++)if(!this.Ic[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.Ic.push(r)}};var xr=i=>i.map(r=>String.fromCharCode(r)).join(""),dG=new Date().getFullYear(),uG=xr([67,111,112,121,114,105,103,104,116,32])+dG+xr([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),kC=xr([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),j0=new Array(50).fill("-").join(""),pG=xr([86,105,115,117,97,108,108,121,74,115,32])+Dm,gG=xr([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),mG=xr([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),EG=xr([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Oa=xr([10,10]),H0=j0+Oa+pG+Oa+uG+Oa+kC+Oa+gG+Oa+mG+Oa+EG+Oa+j0,k0=xr([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),fG=xr([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,56,48,34,32,104,101,105,103,104,116,61,34,51,48,34,62]),W0=xr([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),yG=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],xG=W0+'<path d="'+yG.join('"/><path d="')+'"/></g>',bG=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],AG=W0+'<path d="'+bG.join('"/><path d="')+'"/></g>',Z0=fG+xG+"<g>"+xr([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+AG+xr([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),SG=xr([60,97,32,104,114,101,102,61,34])+kC+xr([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+k0+'">'+Z0+"</a>",WC=null;function qp(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),qp(i,!0,s)};r||console.log(H0),WC&&window.clearInterval(WC),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(SG,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",kC),s.setAttribute("target","_blank"),s.setAttribute("title",k0),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),WC=window.setInterval(()=>a(),25e3)}}var ZC=null;function JC(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),JC(i,!0,n)};r||console.log(H0),ZC&&window.clearInterval(ZC),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(Z0,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((g,m)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),ZC=window.setInterval(()=>u(),25e3)}}var KC="vjs-orthogonal-handle",Qp="vjs-orthogonal-segment-drag",qC="vjs-orthogonal-segment-drag-ns",QC="vjs-orthogonal-segment-drag-ew";var TG=10,vG=20,eo=class extends Ji{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+Qp+" *",target:"."+Qp,drag:n=>{let o=n.el.Ft,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=iS(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Ft,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.Dm(!0),this.$updateModel(Ur(n.el.Ft.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=Ur(n.el.Ft.connection.connector)}})}Nm(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;we(e.el,{x:o,y:s})}$repaint(e){this.dn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],js(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.Nm(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.dn(),this.currentConnector.edited=!0}$elementDragged(e){this.Dm(!0)}$elementDragging(e){this.$repaint()}dn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===Oc,d=this.$makeOrthogonalHandle(h,a,l,vG,TG,[Mn,KC,Qp,h?QC:qC].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Ft=u,this.segmentHandles.push(u),this.Nm(u,s)}else o===n&&this.segmentHandles.push(t)}}Dm(e){this.current&&this.$hasEdits&&(oS(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(eo,"type",Xs);Rr.set(eo.type,eo);function eP(){Rr.set(eo.type,eo)}var Fh="vjs-straight-handle",ss="vjs-straight-segment-drag",eg="vjs-straight-segment-split",tg="vjs-straight-segment-delete",tP="vjs-straight-editor-guideline";var rg=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(Y(eg)).Ft;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(Y(tg)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,Y(eg),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,Y(tg),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Mn,Fh,eg].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Mn,Fh,tg].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var Ry="vjs-straight-connector-edit",rP="click",CG="auto";var Ly=class{constructor(r){this.editor=r;c(this,"Fc");c(this,"Uc");c(this,"$segmentToDrag");c(this,"$pageEvent");this.Fc=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=ge(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);le(e.e);let o=BA(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.Uc=(e=>{let t=e.target.closest(Y(ss)).Ft;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){jr(r,Ry),this.editor.ui.bind(El,this.Fc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${Y(ss)} *`,this.Uc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(El,this.Fc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.Uc),this.editor.current!=null&&Pr(this.editor.current,Ry)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],pe,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var to=class extends Ji{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===rP?new rg(this):new Ly(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+ss+" *",target:"."+ss,drag:n=>{let o=n.el.Ft,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(Ur(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=Ur(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(Ur(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(Ur(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Mn,Fh,ss].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Ft=l),this.segmentHandles.push(l)}this.eb()}this.$mode.$repaintEnded()}eb(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=B(Pe,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[tP,fp].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=B(te,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(to,"type",Cn);Rr.set(to.type,to);function nP(){Rr.set(to.type,to)}var Uh="vjs-bezier-handle",wy="vjs-bezier-handle-control-point",iP="vjs-bezier-handle-control-point-1",oP="vjs-bezier-handle-control-point-2",sP="vjs-bezier-guideline";var ui=class extends Ji{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"ft");c(this,"Be");c(this,"Ut");c(this,"zc");c(this,"Yc");c(this,"Im",{x:0,y:0});c(this,"Mm",{x:0,y:0});this.ft=t.handleSize||Up,this.$addDragHandler({selector:"."+Uh+" *",target:"."+Uh,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Be:this.Ut,h=a===0?this.Im:this.Mm;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.Im=Object.assign({},this.Be),this.Mm=Object.assign({},this.Ut),!0)})}$activate(e,t){this.Vm(),this.Gm(),this.tb((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.Vm(),this.Gm(),this.$m(),this.rb()}tb(e){this.h1=this.$makeAndAppendCircularHandle(this.Be.x,this.Be.y,this.ft,this.ft,[Mn,Uh,wy,iP].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Ut.x,this.Ut.y,this.ft,this.ft,[Mn,Uh,wy,oP].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Cr,this.lockHandles||(this.h2.style.display=Cr),this.l1=this.Bm(this.zc,this.Be.x,this.Be.y),this.l2=this.Bm(this.Yc,this.Ut.x,this.Ut.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Cr:pt,this.l2.style.display=e?Cr:pt,this.$m()}$m(){this.$setElementPosition(this.h1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.$setElementPosition(this.h2,e.x,e.y)}Bm(e,t,n){let o=B(Pe,{width:5,height:5}),s=B(te,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,sP),this.ui.$addClassToElement(o,fp),this.Xc(e,o,t,n),o}rb(){this.Xc(this.zc,this.l1,this.Be.x,this.Be.y);let e=this.lockHandles?this.Be:this.Ut;this.Xc(this.Yc,this.l2,e.x,e.y)}Xc(e,t,n,o){on(t,e);let s=n-e.x,a=o-e.y;ce(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Gm(){this.currentConnector&&(this.Be=this.currentConnector.geometry.segments[0].cp1,this.Ut=this.currentConnector.geometry.segments[0].cp2)}Vm(){this.current&&(this.zc={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.Yc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(ui,"type",Po);var ro=class extends ui{constructor(r,e){super(r,e),this.lockHandles=!0}};c(ro,"type",Hd);Rr.set(ui.type,ui),Rr.set(ro.type,ro);function aP(){Rr.set(ui.type,ui),Rr.set(ro.type,ro)}var J0="selected-vertices",zh=class extends oa{constructor(e,t,n,o,s){var h,d,u,p,g,m,E,y,x;super(e,t,n,o,s,pn(o.defaults||{},{managedElementsSelector:be(_t,en)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"Un");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"jc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"Fm");c(this,"mode",yr);if(this.Un=pv(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.jb=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Wr(Mt,Pe,{position:"absolute",left:"0",top:"0"},uf,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Wr(Mt,Pe,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Wr(Mt,q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Wr(Mt,q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Wr(Mt,q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Wr(null,We,{position:"relative",width:On,height:On},uf,{},this.rootElement,!0),this.vertexLayer=Wr(null,We,{left:0,top:0,position:"absolute",width:On,height:On},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Wr(Mt,Pe,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),qp(this.rootElement,!1),this.jc=o.elementsDraggable!==!1,this.jc===!1&&this.canvasElement.setAttribute(lS,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new Kp({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new ua(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(da),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||Zi),this.Fm=new mp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Tl:f=>{L(this.rootElement,Dn)},Ol:f=>{F(this.rootElement,Dn)},vl:f=>{},Cl:f=>{F(this.rootElement,Dn)}}),new Ep({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.Fm}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(su),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,cf),Rn()&&L(this.rootElement,LT),oi()&&L(this.rootElement,wT),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,df);let a=(f,b,A)=>{let T=S=>{let R=S.srcElement||S.target;if(R===this.rootElement||R===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(R)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===yo&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,yo,xt),a(Br,$b),this.panZoom=new ha({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>we(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.j(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(g=o.pan)==null?void 0:g.useMetaKey,wheel:this.nb(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(m=o.pan)==null?void 0:m.filter,events:{panStart:()=>{L(this.rootElement,Ef),L(document.body,gt)},[fl]:(f,b,A,T,S)=>{this.fire(fl,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[Kn]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(Kn,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[se]:()=>{F(this.rootElement,Ef),F(document.body,gt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,Y(au),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.hu(o),this.$dataLoadStart();let l=this.Wd();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}ib(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{we(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===Et&&(d=d||et(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||et(n),h-=d.height),we(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.Un.length;t++)this.ib(this.Un[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}Cu(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.jc!==!1&&(this.mode===yr||this.mode===hi)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.ps(de.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.ps(ie.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}nb(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.Un.length;e++)this.Un[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.ie(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,eP(),nP(),aP()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.wm(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),K(e.obj)||z(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.wm({id:J0,active:!0,membership:Pa},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||z(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(J0)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=X(e)?{id:e,active:!0,membership:Pa}:Object.assign(e,{membership:Pa});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:Gn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.Fa.length;t++)try{e=this.Fa[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,cf),F(this.rootElement,RT),F(this.rootElement,df),this.ie(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Oi,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=X(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new Nf(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.Un.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}centerOnAndZoom(e,t,n){let o=this.getObjectInfo(e,!1);o.el!=null&&this.panZoom.centerOnAndZoom({bounds:this.viewport.getElementBounds(o.id),fillRatio:t,doNotAnimate:n})}centerOn(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOn({bounds:this.viewport.getElementBounds(t.id)})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.Um=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.Um!=null&&this.off(this.vertexLayer,e,t.Um)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=st,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[yr]:()=>{this.panZoom.setEnabled(!0)},[hi]:()=>{this.panZoom.setEnabled(!1)},[Zo]:()=>{this.panZoom.setEnabled(!1)},[In]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===hi&&!t&&this.model.clearSelection(),this.fire(An,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(zh,"type","Surface");var Dy=class extends Td{fetchUrl(r){ta(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?aa:sa,o=t||yh(n,e==null?void 0:e.useSvgContainer,e);return q0(this,r,o,e)}renderDiagram(r,e){return new Jp(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?aa:sa,s=n||yh(o,e==null?void 0:e.useSvgContainer,{});return Q0(this,r,s,e,t)}};function an(i){return i=i||{},new Dy(i)}function PG(i,r){i.bind(kt,e=>{r.$nodeAdded(e)}),i.bind(jt,e=>{r.$groupAdded(e)}),i.bind(Re,e=>{r.$nodeRemoved(e)}),i.bind(Ie,e=>{r.$groupRemoved(e)}),i.bind(sr,e=>{r.$edgeAdded(e)}),i.bind(yt,e=>{r.$edgeRemoved(e)}),i.bind(yn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function q0(i,r,e,t){return K0(i,r,e,(n,o,s,a,l)=>new zh(n,s||n,a,o,l),t)}function K0(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new hr(i,{generator:s.selection}));let a=s.id||G(),l=t(i,s,o,r,e);return o!=null&&PG(o,l),i.$addRenderer(l,a),l}function Q0(i,r,e,t,n){return K0(i,r,e,(o,s,a,l,h)=>new Yh(o,a||o,l,s,h,n),t)}var OG=i=>i.map(r=>String.fromCodePoint(r)).join(""),_G=[99,114,101,97,116,101,69,108,101,109,101,110,116];function RG(){return document}var ew=i=>RG()[OG(_G)](i);var Yh=class extends oa{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");this.id=o.id||G(),this.$margin=o.margin||yT,this.$horizontalAlign=o.horizontalAlign||o.align||Yo,this.$verticalAlign=o.verticalAlign||o.align||Yo,o.useSvgContainer?this.$canvas=B(Pe,{width:"100%",height:"100%"}):(this.$canvas=ew("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,ET),L(this.$canvas,fT),n.appendChild(this.$canvas),this.setContainer(this.$canvas),qp(this.rootElement,!1),this.bindAll([xn,Ns,It,Vr,Re,Ie,$r,Gr,bn,Eb,Ds],()=>{this.syncView()}),this.hu(o),this.$dataLoadStart();let h=this.Wd();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.Xe,t=et(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h),u=n*d,p=o*d;if(Rt(this.$canvas)){let g=0,m=0;switch(this.$horizontalAlign){case Yo:break;case Jl:g-=(s-d*n)/2;break;case Kl:g+=(s-d*n)/2;break}switch(this.$verticalAlign){case Yo:break;case Jl:m-=(a-d*o)/2;break;case Kl:m+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${g}, ${m})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let g=(-e.xmin+this.$margin)*d,m=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case Jl:break;case Yo:g+=(s-u)/2;break;case Kl:g+=s-u;break}switch(this.$verticalAlign){case Jl:break;case Yo:m+=(a-p)/2;break;case Kl:m+=a-p;break}let E=`translateX(${g}px) translateY(${m}px) scale(${d})`;this.$canvas.style.transform=E}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return console.log("toPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromPageLocation(e,t,n){return console.log("fromPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromWindowLocation(e,t,n){return console.log("fromWindowLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}mapEventLocation(e){return console.log("mapEventLocation not necessarily correct - implement in base browser ui"),this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=et(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}getApparentCanvasLocation(){return console.log("paper get aparent canvas loc - is it correct to return 0,0?"),{x:0,y:0}}addBackground(e){console.log("add background to paper - what needs to happen?")}removeBackground(e){console.log("remove background from paper - what needs to happen?")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function LG(i,r,e,t){let n=an(e||{}),o=r!=null&&r.useSvgContainer?aa:sa,s=yh(o,r==null?void 0:r.useSvgContainer,{}),a=new Yh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function wG(i,r,e){if(Gt(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if(Gt(t,e,i))return t;t=t.parentNode}}}function DG(i){return typeof i=="function"?(i.oo=G(),i.oo):i}function NG(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=wG(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=Gt(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var dP="start",uP="beforeStart",pP="drag",nw="drop",iw="over",ow="out",gP="stop",tw="katavorio-draggable",IG=tw,MG=10,VG=10,lP=function(){return!0},GG=function(){return!1},hP={delegatedDraggable:"katavorio-delegated-draggable",draggable:IG,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},rw=[gP,dP,pP,nw,iw,ow,uP],$G=function(){},Xh=function(i,r){if(i!=null){i=!X(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},BG=function(i,r,e){let t=i.srcElement||i.target;return!Gt(t,e.getInputFilterSelector(),r)},cP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",G());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};Xh(this.scopes,t=>{e[t]=!0}),Xh(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};Xh(this.scopes,t=>{e[t]=!0}),Xh(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};Xh(this.scopes,t=>{e[t]=!0}),Xh(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},sw="notNegative",aw="parent",lw="parentEnclosed";function mP(i,r){let e=null;switch(i){case sw:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case aw:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case lw:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var Ny=class extends cP{constructor(e,t,n){super(e,n);c(this,"zm");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"Z");c(this,"Pe");c(this,"Et");c(this,"Xs");c(this,"js",{x:0,y:0});c(this,"ao",{x:0,y:0});c(this,"Je");c(this,"ks");c(this,"Hs");c(this,"E");c(this,"kc");c(this,"lo");c(this,"co");c(this,"zn",!1);c(this,"Ws");c(this,"Yn");c(this,"Hc");c(this,"V");c(this,"ho",[]);c(this,"Ym");c(this,"Xm");c(this,"bn");c(this,"xr");c(this,"Wc");c(this,"uo",{});c(this,"Zs");c(this,"ye");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.zm=this.manager.css.draggable,L(this.el,this.zm),this.downListener=this.kr.bind(this),this.upListener=this.pr.bind(this),this.moveListener=this.Hr.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.Ym=t.canDrag||lP,this.Xm=t.consumeFilteredEvents,this.bn=t.parent,this.xr=t.ignoreZoom===!0,this.Ws=t.ghostProxyParent,this.Wc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.ob.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.Yn=lP:t.ghostProxy&&typeof t.ghostProxy=="function"?this.Yn=t.ghostProxy:this.Yn=(o,s)=>this.V&&this.V.useGhostProxy?this.V.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Hc=t.makeGhostProxy:this.Hc=o=>this.V&&this.V.makeGhostProxy?this.V.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(tw);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.ho.push(t)}this.eventManager.on(this.el,pe,this.downListener)}ob(e){if(this.Et){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.js.x,o=t.y-this.js.y,s={x:n+this.Xs.x,y:o+this.Xs.y},a=s.x-this.Z.x,l=s.y-this.Z.y,h=this.xr?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.ao.x,l+=this.E.parentNode.scrollTop-this.ao.y),a/=h,l/=h,this.moveBy(a,l,e),this.Xs=s,this.js=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}pr(e){this.Z&&(this.Z=null,this.eventManager.off(document,oe,this.moveListener),this.eventManager.off(document,se,this.upListener),this.unmark(e),this.stop(e),this.Et=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.V&&this.V.revertFunction&&this.V.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this.Pe))}kr(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Ym())if(this.Bc(e)&&BG(e,this.el,this.manager)){this.V=null,this.ye=null,this.ho.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=NG(this.ho,this.el,o);if(s!=null&&(this.V=s[0],this.ye=s[1]),this.V==null||this.ye==null)return;let a=this.V.dragInit?this.V.dragInit(this.ye,e):null;a!=null&&(this.ye=a);let l=1;if(this.clone)if(this.E=this.ye.cloneNode(!0),L(this.E,hP.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.bn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.bn.appendChild(this.E)}else{let h=zi(this.ye,!0),d=this.ye.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.Wc&&!this.xr&&(l=this.Wc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.ye;this.consumeStartEvent&&le(e),this.Z=ge(e),this.E&&this.E.parentNode&&(this.ao={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this.Pe=this.manager.positionGetter(this.E),this.Je=this.manager.getSize(this.E),this.Je.width=this.Je.width*l,this.Je.height=this.Je.height*l,this.eventManager.on(document,oe,this.moveListener),this.eventManager.on(document,se,this.upListener),this.Js(uP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Je})}else this.Xm&&le(e)}Hr(e){if(this.Z){if(!this.Et){let t=this.Js(dP,{el:this.el,pos:this.Pe,e,drag:this,size:this.Je});if(t!==!1){if(!this.Z)return;this.mark(t),this.Et=!0}else this.abort()}if(this.Z){let t=ge(e),n=t.x-this.Z.x,o=t.y-this.Z.y,s=this.xr?1:this.manager.zoom;this.Xs={x:t.x,y:t.y},this.js={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.ao.x,o+=this.E.parentNode.scrollTop-this.ao.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this.Pe!=null&&this.Z!=null?{x:this.Z.x-this.Pe.x,y:this.Z.y-this.Pe.y}:{x:0,y:0}}mark(e){this.Pe=this.manager.positionGetter(this.E),this.Je=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.Zs=this.manager.getParentConstrainingRectangle(this.E),this.lo=0,this.co=0}unmark(e){this.zn&&this.Yn(this.ye,this.E)?(this.kc={x:this.E.offsetLeft-this.lo,y:this.E.offsetTop-this.co},this.E.parentNode.removeChild(this.E),this.E=this.ye):this.kc=null,F(this.E,this.manager.css.drag),this.zn=!1}moveBy(e,t,n){let o=this.toGrid({x:this.Pe.x+e,y:this.Pe.y+t}),s=this.sb(o,this.E,this.Zs,this.Je,{x:this.Pe.x,y:this.Pe.y},n);if(s!=null){if(this.Yn(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.zn){let a=this.Hc(this.ye);L(a,hP.ghostProxy),this.Ws?(this.Ws.appendChild(a),this.ks=zi(this.ye.parentNode),this.Hs=zi(this.Ws),this.lo=this.ks.x-this.Hs.x,this.co=this.ks.y-this.Hs.y):this.ye.parentNode.appendChild(a),this.E=a,this.zn=!0}s=o}else this.zn&&(this.E.parentNode.removeChild(this.E),this.E=this.ye,this.zn=!1,this.ks=null,this.Hs=null,this.lo=0,this.co=0);this.manager.positionSetter(this.E,{x:s.x+this.lo,y:s.y+this.co}),this.Js(pP,{el:this.el,pos:s,e:n,drag:this,size:this.Je,originalPos:this.Pe,viewport:this.Zs})}}abort(){this.Z!=null&&this.pr()}getDragElement(e){return e?this.ye||this.el:this.E||this.el}stop(e,t){if(t||this.Et){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.Je]),this.Js(gP,{el:this.E,pos:this.kc||o,finalPos:o,e,drag:this,selection:n,size:this.Je,originalPos:{x:this.Pe.x,y:this.Pe.y},viewport:this.Zs})}else this.Et||this.V.dragAbort&&this.V.dragAbort(this.ye)}Js(e,t){let n=null;if(this.V&&this.V[e])n=this.V[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:MG/2,thresholdY:VG/2};return this.V!=null&&this.V.grid!=null&&(e.grid=this.V.grid,this.V.snapThreshold!=null&&(e.thresholdX=this.V.snapThreshold,e.thresholdY=this.V.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return ae(e,t,s,a)}}setUseGhostProxy(e){this.Yn=e?lP:GG}sb(e,t,n,o,s,a){return this.V!=null&&this.V.constrainFunction&&typeof this.V.constrainFunction=="function"?this.V.constrainFunction(e,t,n,o,s,a):e}Bc(e){for(let t in this.uo){let n=this.uo[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=DG(e);this.uo[n]=[o=>{let s=o.srcElement||o.target,a;return X(e)?a=Gt(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.oo:e;delete this.uo[t]}clearAllFilters(){this.uo={}}addSelector(e,t){e.selector&&(t?this.ho.unshift(e):this.ho.push(e))}destroy(){this.eventManager.off(this.el,pe,this.downListener),this.eventManager.off(document,oe,this.moveListener),this.eventManager.off(document,se,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},FG=["input","textarea","select","button","option"],UG=FG.join(","),ng=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||UG,this.eventManager=new fe,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}ab(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<rw.length;t++){let n=rw[t];e.events[n]=r[n]||$G}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.po==null){let t=this.ab(e),n=new Ny(r,t,this);return L(r,hP.delegatedDraggable),r.po=n,n}else return r.po}destroyDraggable(r){r.po&&(r.po.destroy(),delete r.po)}};var hw=15,cw=10,dw="markers",uw="lineStyle",pw="sourceArrow",gw="targetArrow",mw="bothArrows",Ew="plain",fw="dashed";function zG(i){let r=(i==null?void 0:i.arrowWidth)||hw,e=(i==null?void 0:i.arrowLength)||cw,t=(i==null?void 0:i.lineStyleProperty)||uw,n=(i==null?void 0:i.markersProperty)||dw;return[{property:t,mappings:{[Ew]:{},[fw]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[pw]:{overlays:[{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]},[gw]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}}]},[mw]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}},{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var EP={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");EP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(EP.get(i))}};var fP=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new ng({positionGetter:o=>sn(o),positionSetter:(o,s)=>Jt(o,s),getSize:o=>et(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=mP(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function YG(i){yw?i():yP.push(i)}var yP=[],yw=!1,Iy=()=>{yw=!0;for(let i=0;i<yP.length;i++)yP[i]()},xP=class{constructor(r){this.templateHolder=r;c(this,"c",0)}jm(){this.c--,this.c<=0&&Iy()}add(r){this.c++,ta({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.jm()},error:e=>{this.jm()}})}ensureNotEmpty(){this.c<=0&&Iy()}},xw="_vjs_templates",XG=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById(xw);if(r)Iy();else{r=document.createElement("div"),r.style.display="none",r.id=xw,document.body.appendChild(r);let e=new xP(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else Iy()};i()};XG();var bw="vjs-test-support-container",jG=1e-11;function Aw(){let i=document.getElementById(bw);return i==null&&(i=document.createElement("div"),i.id=bw,document.body.appendChild(i)),i}var ig=[],HG=[];function My(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):Aw().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",ig.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function kG(i,r){for(let e=0;e<i.length;e++)My(i[e],r)}function WG(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function og(i){WG(document.querySelectorAll(i))}function ZG(){for(let i=0;i<ig.length;i++)ig[i].el.parentNode.removeChild(ig[i].el);ig.length=0,og("circle"),og(".vjs-node"),og(".vjs-surface-canvas"),og("svg"),og(".vjs-lasso"),Aw().innerHTML=""}function JG(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function as(i){return i.connector.canvas}function Bt(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return br(s,a,r)}function bP(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return br(n.x+r,n.y+e,t)}function Sw(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var Tw={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function KG(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return br(i,r)}function vw(i,r,e){let t=i;e=e||{},e.start&&e.start(),ln(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=KG();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",Tw),e.up&&e.up()}function Cw(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);ln(i,s);let a=Tw;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=br(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function Pw(i,r,e,t){let n=My("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function qG(i,r,e,t){let n=an(i),o,s;if(r!=null){let l=Pw(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return HG.push(a),a}function QG(i,r){let e=i.surface.getRenderedConnection(r),t=as(e),n=Bt(t);i.surface.trigger(t.querySelector("path"),"click",n)}function e$(i,r){let e=i.surface.getRenderedConnection(r),t=as(e),n=Bt(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function t$(i,r){let e=i.surface.getRenderedConnection(r),t=as(e),n=Bt(t);var o=t.querySelector("path");i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n)}function r$(i,r){let e=i.surface.getRenderedConnection(r),t=as(e),n=Bt(t);var o=t.querySelector("path");i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n)}function sg(i,r,e){let t=i.surface.getRenderedConnection(r),n=as(t),o=Bt(n);i.surface.trigger(n.querySelector("path"),e,o)}function AP(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,1,1)}function ag(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);ln(i.surface,t,1),Hh(i.surface,t,1)}function n$(i,r,e){Vy(i,r,Un,1,e)}function i$(i,r,e){Vy(i,r,"mouseover",1,e)}function o$(i,r,e){Vy(i,r,"mouseout",1,e)}function Vy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);kh(i.surface,s,e,t,n)}function jh(i,r,e=1,t=1){let n=Bt(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function Ow(i,r,e=1){let t=Bt(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function ln(i,r,e=1,t){kh(i,r,ls,e,t)}function Hh(i,r,e=1,t){kh(i,r,no,e,t)}function kh(i,r,e,t=1,n){let o=Bt(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function SP(i,r,e,t,n=1){let o=br(t.x,t.y),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,n||1,null),r.dispatchEvent(s)}function s$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jh(i.surface,t,2,1)}function a$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Ow(i.surface,t,1)}function l$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");jh(i.surface,o,1,1)}function h$(i,r){jh(i.surface,r,1,1)}function c$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Ow(i.surface,o,1)}function _w(i,r){ln(i.surface,r),Hh(i.surface,r)}function d$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");_w(i,o)}function u$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");ln(i.surface,o),Hh(i.surface,o),ln(i.surface,o),Hh(i.surface,o)}function p$(i,r,e){let t=i.surface.getRenderedConnection(r),n=ME(t,e||"lbl");jh(i.surface,n.contentElements[0],1,1)}function g$(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(si(en,e));o&&jh(i.surface,o,1,1)}function TP(i,r,e,t,n){t=t||{};let o=i,s;Yi(e)?s=Bt(e,null,n):s=bP(i.$getCanvasElement(),e.x,e.y);let a=i.model.getAllEdges().length;t.start&&t.start(),ln(i,r),t.down&&t.down();let l=Object.values(i.$_connMap).find(u=>u.edge.transient);if(l!=null&&o.trigger(as(l).childNodes[0],ot,s),o.trigger(document,Un,s),t.move){let u=i.model.getAllEdges().filter(g=>g.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}o.trigger(document,no,s);let h=i.model.getAllEdges()[a],d=h?i.getRenderedConnection(h.id):null;return t.up&&t.up(d),d}function Rw(i,r,e,t,n,o){let s=i.getObjectInfo(t,!1);if(s.el){n=n||{};let a=i.getRenderedConnection(r.id),l=e?".vjs-connector-source-drag":".vjs-connector-target-drag",h=a.connector.canvas.querySelector(l);n.start&&n.start(),ln(i,h),n.down&&n.down();let d=Bt(s.el,null,o);i.trigger(document,"mousemove",d),n.move&&n.move(),i.trigger(document,"mouseup",d),n.up&&n.up(a)}else throw`Cannot resolve drag element ${t}`}function vP(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Bt(r);o.trigger(r,ls,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=br(e+a.width/2,t+a.height/2);o.trigger(document,Un,l),n.afterMove&&n.afterMove(),o.trigger(document,se,l),n.afterUp&&n.afterUp()}function CP(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Bt(r,o);s.trigger(r,ls,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,Un,Sw(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,no,null),n&&n.afterUp&&n.afterUp()}function Lw(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Bt(r,s);a.trigger(r,ls,p),o&&o.afterDown&&o.afterDown();for(let g=0;g<n;g++)a.trigger(document,Un,Sw(p,d,u,s)),o&&o.afterMove&&o.afterMove(g),d+=l,u+=h;a.trigger(document,no),o&&o.afterUp&&o.afterUp()}var m$=typeof document!="undefined",Gy=m$?"ontouchstart"in document.documentElement:!1,ls=Gy?"touchstart":"mousedown",Un=Gy?"touchmove":"mousemove",no=Gy?"touchend":"mouseup";function br(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function ww(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function Dw(i,r,e,t){let n=i.vertexLayer;PP(i,n.parentElement.parentElement,r,e,t)}function PP(i,r,e,t,n){n&&n.start&&n.start();let o=i.toPageLocation(e.x,e.y),s=i.toPageLocation(t.x,t.y);o.x-=window.scrollX,s.x-=window.scrollX,o.y-=window.scrollY,s.y-=window.scrollY,SP(i,r,ls,o),n&&n.down&&n.down(),SP(i,document,Un,s),n&&n.move&&n.move(),SP(i,document,no,s),n&&n.up&&n.up()}var pi={addDiv:My,addDivs:kG,cleanup:ZG,delta:JG,DOWN_EVENT:ls,UP_EVENT:no,MOVE_EVENT:Un,isTouchDevice:Gy,makeEvent:Bt,makeEventAt:br,nudgeEvent:ww,getEdgeCanvas:as,defaultEventManager:new fe,dragElementBy:(i,r,e,t)=>{CP(pi.defaultEventManager,i,r,e,t)},attachToSurface:i=>new lg(i.model,i),create:(i,r,e,t)=>{let n=qG(i,r,e,t);return new lg(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:Dw,lassoOnElement:PP,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=pi);function Nw(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=br(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),ln(i,r),o.down&&o.down(),i.trigger(document,Un,l),o.move&&o.move(),i.trigger(document,no,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var lg=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"Zc");c(this,"consoleOutput","");this.eventManager=new fe,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this.Zc==null&&(this.Zc=new ua(this.surface)),this.Zc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=Pw(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){vw(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){vw(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return as(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;vP(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;vP(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)vP(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)CP(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){CP(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){Lw(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)Lw(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||co,null)}mo(r){let e;if(lT(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}km(r,e){return{sourceEl:this.mo(r),targetEl:this.mo(e)}}dragConnection(r,e,t,n){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:o,targetEl:s}=this.km(r,e);return TP(this.surface,o,s,t,n)}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.km(r,e);return Nw(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.mo(r);return TP(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.mo(e);return TP(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.mo(e);return Nw(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return Cw(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return Cw(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n){Rw(this.surface,r,!1,e,t,n)}relocateEdgeSource(r,e,t,n){Rw(this.surface,r,!0,e,t,n)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Bt(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?bP(r,n,o,t):Bt(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=bP(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Bt(n.el);return e||t?ww(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return br(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){AP(this,r)}clickOnNode(r){AP(this,r)}clickOnVertex(r){AP(this,r)}dblClickOnVertex(r){a$(this,r)}rightClickOnVertex(r){s$(this,r)}tapOnVertex(r){ag(this,r)}tapOnNode(r){ag(this,r)}tapOnGroup(r){ag(this,r)}dblTapOnVertex(r){ag(this,r),ag(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){n$(this,r,e)}mouseoverOnVertex(r,e){i$(this,r,e)}mouseoutOnVertex(r,e){o$(this,r,e)}contextmenuOnVertex(r,e){Vy(this,r,xt,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)ln(this.surface,this.canvas,e),Hh(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){ln(this.surface,this.canvas,t,{x:r,y:e}),Hh(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){kh(this.surface,this.canvas,Un,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){kh(this.surface,this.canvas.parentNode,ls,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){kh(this.surface,this.canvas,no,1,{x:r,y:e})}lasso(r,e,t){Dw(this.surface,r,e,t)}lassoOnElement(r,e,t,n){PP(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){h$(this,r)}clickOnElementInsideVertex(r,e){l$(this,r,e)}dblClickOnElementInsideVertex(r,e){c$(this,r,e)}tapOnElement(r){_w(this,r)}tapOnElementInsideVertex(r,e){d$(this,r,e)}dblTapOnElementInsideVertex(r,e){u$(this,r,e)}mousedownOnElement(r){ln(this.surface,r)}clickOnEdge(r){QG(this,r)}dblClickOnEdge(r){e$(this,r)}tapOnEdge(r){let e=tt(r)?r.id:r;t$(this,e)}dblTapOnEdge(r){let e=tt(r)?r.id:r;r$(this,e)}Hm(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),g=p.x,m=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(g+13)*s,f=(m+13)*s,b=g+a*s+u.width/2,A=m+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=br(E,y);this.surface.trigger(h,pi.DOWN_EVENT,T),t&&this.surface.trigger(h,pi.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,pi.MOVE_EVENT,br(x,f));let S=br(b,A);if(this.surface.trigger(d,pi.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let R=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(R,pi.DOWN_EVENT,S),this.surface.trigger(R,pi.UP_EVENT,S)}else this.surface.trigger(d,pi.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.Hm(r,e,!1,t)}tapFromPalette(r,e,t){this.Hm(r,e,!0,t)}mousedownOnEdge(r){sg(this,r,pe)}mouseupOnEdge(r){sg(this,r,se)}mouseoverOnEdge(r){sg(this,r,ot)}mouseoutOnEdge(r){sg(this,r,it)}contextmenuOnEdge(r){sg(this,r,xt)}clickOnOverlay(r,e){p$(this,r,e)}clickOnPort(r,e){g$(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Bt(r);this.eventManager.trigger(r,ls,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,Un,br(u.x+1,u.y+1)),this.eventManager.trigger(d,Un,br(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,no,br(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=My("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new Hp(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<jG,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var OP="vjs-chart-background",_a="vjs-chart-plot-background",Wh="vjs-chart-body",_P="vjs-chart-series",RP="vjs-chart-legend",hg="vjs-chart-legend-item",LP="vjs-chart-legend-label",wP="vjs-chart-legend-dot",Ra="vjs-chart-axis",cg="vjs-chart-x-axis",dg="vjs-chart-y-axis",$y="vjs-chart-axis-labels",By="vjs-chart-axis-line",Fy="vjs-chart-axis-title",DP="vjs-chart-y-axis-title",NP="vjs-chart-x-axis-title",IP="vjs-column-chart",MP="vjs-column-chart-column",VP="vjs-bar-chart",GP="vjs-bar-chart-bar",hn="vjs-chart-point",ug="vjs-chart-point-hit-area",$P="vjs-bubble-chart",BP="vjs-bubble-chart-point",FP="vjs-scatter-chart",UP="vjs-scatter-chart-point",pg="vjs-area-chart-area",zP="vjs-chart-title",YP="vjs-chart-subtitle",Zh="vjs-chart-crosshair",Jh="vjs-chart-crosshair-label",XP="vjs-chart-crosshair-value-axis",jP="vjs-chart-crosshair-category-axis",Uy="vjs-chart-empty",HP="vjs-chart-axis-scale-label",zy="vjs-chart-gridlines",Yy="vjs-chart-gridline",kP="vjs-line-chart",WP="vjs-area-chart";var E$=6;function Xy(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function f$(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function y$(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function Mw(i,r,e,t,n,o){let s=Xy(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=f$(s.step),u=Xy(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=y$(s.step),u=Xy(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function Kh(i,r,e=E$,t,n){let o=r-i,s=Vw(o);return Mw(i,r,s,e,t,n)}function ZP(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function qh(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function Vw(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function gi(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=B(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function hs(i,r,e,t){let n=k(Qe,r,e,t);return n.innerHTML=i,n}function x$(i,r){let e=eh(i);Ft(i,r,e.y)}function Qh(i,r){let e=eh(i);Ft(i,e.x,r)}function Ft(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function cn(i){return i.type==="value"}function JP(i){return i.type==="category"}function ec(){return{x:0,y:0,width:0,height:0}}function jy(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function KP(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(Je(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function Iw(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function gg(i,r,e,t,n,o){let s=B(Qe,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=B("tspan",{fill:Iw(t),stroke:Iw(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=B("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function Hy(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Mt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),b$(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${Zh}, .${Jh}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),g=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(g),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function b$(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var A$="vertical",ky="horizontal",Gw=10,Wy="left",Zy="center",qP="right",tc="top",rc="middle",Jy="bottom",mg=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||Gw,this.orientation=r.orientation||ky,this.align=r.align||Zy,this.valign=r.valign||Jy,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=gi(12,"normal","normal","sans-serif",r.font)}};var Eg="chart:load",QP="No data",eO="Could not draw chart";var $w="vjs-chart-exporter-hamburger",S$="vjs-chart-exporter-menu",T$="vjs-chart-exporter-menu-item",Bw="vjs-chart-exporter-hamburger-open",fg=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"go",!1);this.eventManager=new fe,this.eventManager.on(r.container,W,Y($w),t=>{t.stopPropagation(),this.go?this.Jc():this.lb()})}cb(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=kr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},$w),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=kr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=kr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},S$),[{label:"Download JPG",type:qo},{label:"Download PNG",type:Oh},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=kr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},T$);a.innerText=s.label,this.eventManager.on(a,Fe,()=>{this.hb(s.type),this.Jc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this.go&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.go&&(n(),this.hideTimeout=setTimeout(()=>{this.Jc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}lb(){this.menu.style.display="block",this.go=!0,L(this.hamburger,Bw);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}Jc(){this.menu.style.display="none",this.go=!1,F(this.hamburger,Bw)}hb(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:ya.svg});this.Wm(n,`${e}.svg`)}else{let t=r===qo?ya.jpeg:ya.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===qo?"jpg":"png";this.Wm(n.url,`${e}.${o}`,!0)})}}Wm(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var v$="0 0 32 30",C$="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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",Fw="0 0 32 32",P$="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",O$="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",_$="vjs-chart-zoom-controls",R$="vjs-chart-zoom-button",Ky=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new fe}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=kr("div",{display:"flex",flexDirection:e},_$),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:P$,viewBox:Fw,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:O$,viewBox:Fw,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:C$,viewBox:v$,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=kr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},R$);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
|
|
134
|
+
</div>`}}var bG=1.25,tm=class{constructor(r,e){this.ui=r;c(this,"Hn");c(this,"qx");c(this,"Xh");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||bG,o=e.iconSize||{width:gG,height:EG};this.onVertexAdded=e.onVertexAdded,this.Xh=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||qu.FILL,a=e.outline||qu.STROKE,l=e.outlineWidth||qu.STROKE_WIDTH;this.Hn=yr({templates:xG(e.showAllMessage)});let h=`<div class="${Uh}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${Ly}">{{label}}</div>`:"")+"</div>";this.Hn.registerTag(yG,{template:h,rendered:(p,m,g,E)=>{var T,S,R;let y=m.type,x=null,f=E.getAttribute(ro)||m.category;f!=null&&p.setAttribute(ro,f);let b=m.shapeId;b!=null&&(p.setAttribute(em,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",m.label||""),m.objectType===ie.objectType&&p.setAttribute(jl,vt);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===ie.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},_=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((R=A.initialSize)==null?void 0:R.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${_} ${P}`),A.icon){let C=this.Hn.parse(A.icon),O=this.Hn.render(C,v).fragment;I.appendChild(O)}else{let C=Bm(pn({},v),{type:y,category:f,width:_,height:P}),O=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(_,P),M=(_-N)/2,D=(P-N)/2;O.setAttribute("transform",`translate(${M}, ${D})`)}I.appendChild(O);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let M in N){let D=M===Eh?"stroke":M===fh?"stroke-width":M;I.setAttribute(D,N[M]),delete B[D]}}for(let N in B)I.setAttribute(N,B[N])}}},updated:(p,m,g)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(m=>Object.assign({},this.$shapeLibrary.getShapeDefinition(m.type,m.category),{shapeId:m.shapeId,properties:m.properties,category:m.category,label:m.label,size:m.size}));this.$preparedShapes=p,d=this.Hn.template(iw,{shapes:p})}else d=this.Hn.template(nw,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.qx=new Ta(r,{source:this.palette,selector:z(Uh),dragSize:e.dragSize,dragSizeGenerator:(p,m)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:KC,elementGenerator:(p,m)=>{let g=p.cloneNode(!0),E=g.querySelector(z(Ly));return E&&E.parentNode.removeChild(E),g},vertexPreviewGenerator:(p,m,g,E,y)=>{let x=Object.assign(g,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:g.outlineWidth||1}),f=G(Pe,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(ph);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,m,g,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:g.width,[r.$modelHeightAttribute]:g.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${g.width} ${g.height}`)},dataGenerator:p=>{var C,O,w,B,N;let m=this.Xh?this.Xh(p)||{}:{},g=p.getAttribute(QC),E=p.getAttribute(ro),y=p.getAttribute(em),x=this.$shapeLibrary.getShapeDefinition(g,E),f=m.fill,b=m.outline,A=m.outlineWidth,T=m.color,S=(C=this.$preparedShapes)==null?void 0:C.find(M=>M.shapeId===y),R=(S==null?void 0:S.properties)||{},v=(O=S==null?void 0:S.size)==null?void 0:O.width,_=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||m.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=_||m.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(m,{type:g,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},R),f!=null&&(m.fill=f),b!=null&&(m.outline=b),A!=null&&(m.outlineWidth=A),T!=null&&(m.color=T),x.payload&&Object.assign(m,x.payload),m},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(z(Fh))).forEach(p=>{p.addEventListener("change",m=>{let g=p.options[p.selectedIndex].value,E=p.getAttribute(ro);p.setAttribute(qC,`${g===_a}`),this.Fm(g,E)})}),e.inspector!==!1){r.model.bind(Jt,g=>{m()}),r.model.bind(Kt,g=>{m()});let p=()=>{Array.from(this.palette.querySelectorAll(z(Ku))).forEach(E=>{F(E,Ku)})},m=()=>{p();let g=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>g.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),g.size===1){let[E,y]=Array.from(g)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${ro}='${y}'][${QC}='${E}']`);f!=null&&L(f,Ku)}}};r.model.bind(rr,()=>{p()}),r.on(this.palette,W,z(Uh),g=>{let E=g.target.closest(z(Uh)),y=E.getAttribute(ro),x=E.getAttribute(QC),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||le.objectType,A=this.Um();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Ve,Oe],g=>{this.Um().containsVertex(g.vertex.id)&&m()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}Um(){return this.ui.model.getSelection().filter(r=>K(r)||Y(r))}Qx(r){return this.palette.querySelector(`${z(Fh)}[${ro}='${r}']`)}Fm(r,e){let t=e==qi?this.palette:this.palette.querySelector(`${z(Qp)}[${ro}='${e}']`);t.setAttribute(qC,`${r==_a}`),Array.from(t.querySelectorAll(z(Qp))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(fG,`${r===_a||r===o.getAttribute(ro)}`)})}zm(r,e){this.Fm(r,e);let t=this.Qx(e);t!=null&&(t.value=r,t.setAttribute(qC,`${r===_a}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==qi;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.zm(o[0],o[1])})}}else this.zm(_a,qi)}};var Dy="vjs-diagram-node",Ny="vjs-diagram-group",tP=100,rP=80,nP=[Cv];var Yn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[$f]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[Eh]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[fh]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Bf]:r})}get label(){return this.vertex.data[Ki]}get fill(){return this.vertex.data[$f]||yh}get outline(){return this.vertex.data[Eh]||Zo}get outlineWidth(){return this.vertex.data[fh]||xh}get color(){return this.vertex.data[Bf]||vv}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var Ei=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof Yn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof Yn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function iP(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ea.type}}var ow=15,Iy="vjs-cell-tool",oP="vjs-clone-cell",sP="vjs-delete-cell",sw="vjs-link-cell",as=class extends ss{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||ow,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.bt/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,z(oP),n=>{let s=n.target.closest(`[${te}]`).getAttribute(te);s!=null&&(he(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,z(sP),n=>{let o=n.target.closest(`[${te}]`),s=o.getAttribute(te);if(s!=null){he(n);let a=this.surface.model.getVertex(s);Y(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}Yh(e,t,n,o){let s=super.Yh(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=G(q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),ip(tp,this.$buttonSize,this.$buttonSize,[oP,Iy],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=G(q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),ip(rp,this.$buttonSize,this.$buttonSize,[sP,Iy],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=G(q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),ip(ep,this.$buttonSize,this.$buttonSize,[sw,Iy],{title:"Click and drag to link","data-vjs-source":!0,[te]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(ci,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(ci,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(ci,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(as,"type","diagramTools"),as=Je([We("diagramTools")],as);var Yh=class extends tm{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(em);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function aP(i){return i.startEditingPath!==void 0}function aw(i){return i.isEmpty()?0:i.head().zIndex}function AG(i){return i.isEmpty()?0:i.peek().zIndex}var rm=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"F");var a,l,h,d,u,p,m,g,E,y,x,f,b,A,T,S,R,v,_,P,I,C,O,w,B,N,M,D,V,J,ye,j,ge,Be,ke,zt,or,tr,wr,ho,Ha,ka,Wa,Za,Ja,Vm,Gm,mc,$m,gc,ps;t=t||{},this.F=t.mediator,this.$_cellList=new Es((ne,ze)=>ne.zIndex<ze.zIndex?-1:ne.zIndex>ze.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||Ki,this.$shapeLibrary=new ia(t.shapes||nP,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new _u(this.model,{fill:t.defaultFillColor||yh,outline:t.defaultOutlineColor||Zo,outlineWidth:t.defaultOutlineWidth||xh,color:t.defaultColor||Zo}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||tP,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||rP,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:as.type,options:{rotationStops:(m=t.cells)==null?void 0:m.rotationStops,canResizeFilter:(ne,ze)=>{var Lt,Tr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.resizable)!==!1&&this.eb(ne,ze)!==!1},canRotateFilter:(ne,ze)=>{var Lt,Tr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.rotatable)!==!1&&this.tb(ne,ze)!==!1},canShowLinkButton:(ne,ze)=>{var Lt,Tr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.linkable)!==!1&&this.rb(ne,ze)!==!1},canDelete:(ne,ze)=>{var Lt,Tr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.deletable)!==!1&&this.nb(ne,ze)!==!1},canClone:(ne,ze)=>{var Lt,Tr;return((Lt=t.cells)==null?void 0:Lt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.clonable)!==!1&&this.ib(ne,ze)!==!1},handleShape:(E=(g=t.cells)==null?void 0:g.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(R=t.cells)==null?void 0:R.resize)==null?void 0:v.method,bordersVisible:(P=(_=t.cells)==null?void 0:_.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(O=t.cells)==null?void 0:O.resize)==null?void 0:w.resizeX,resizeY:(N=(B=t.cells)==null?void 0:B.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let ne=t.snapLines===!0?{}:t.snapLines;n.push({type:rs.type,options:ne})}if(t.panButtons!=null){let ne=t.panButtons===!0?{}:t.panButtons;n.push({type:ns.type,options:ne})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:Qo.type,options:iP()}),t.lasso!=null&&(co(t.lasso)?n.push($n.type):n.push({type:$n.type,options:t.lasso})),t.miniview!=null&&n.push({type:Bn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:ts.type,options:t.dragGroups}),((M=t.edges)==null?void 0:M.highlightSelected)===!0&&n.push({type:fa.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:(V=t.edges)==null?void 0:V.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(J=t.cells)==null?void 0:J.magnetizer,getCollapsedGroupSize:(ye=t.cells)==null?void 0:ye.getCollapsedGroupSize,canCollapseGroup:(ne,ze)=>this.F!=null&&this.F.canCollapse!=null?this.F.canCollapse(ne,ze):!0,canExpandGroup:(ne,ze)=>this.F!=null&&this.F.canExpand!=null?this.F.canExpand(ne,ze):!0,elementsDraggable:this.$editable!==!1&&((j=t.cells)==null?void 0:j.draggable)!==!1,defaults:o,view:this.ob(t),shapes:{library:this.$shapeLibrary,showLabels:((ge=t.cells)==null?void 0:ge.showLabels)!==!1,strokeWidth:(Be=t.cells)==null?void 0:Be.outlineWidth,labelAttribute:(ke=t.cells)==null?void 0:ke.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(zt=t.cells)==null?void 0:zt.font},edges:{editable:t.editable!==!1&&((or=t.edges)==null?void 0:or.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(tr=t.edges)==null?void 0:tr.propertyMappings,avoidVertices:(wr=t.edges)==null?void 0:wr.avoidVertices,allowUnattached:((ho=t.edges)==null?void 0:ho.allowUnattached)!==!1,connector:(Ha=t.edges)==null?void 0:Ha.connector,layerIndex:(ka=t.edges)==null?void 0:ka.layerIndex,sourceMarker:(Wa=t.edges)==null?void 0:Wa.sourceMarker,targetMarker:(Za=t.edges)==null?void 0:Za.targetMarker,overlays:(Ja=t.edges)==null?void 0:Ja.overlays,anchor:(Vm=t.edges)==null?void 0:Vm.anchor,anchors:(Gm=t.edges)==null?void 0:Gm.anchors,inputMethod:(mc=t.edges)==null?void 0:mc.inputMethod,reattach:(($m=t.edges)==null?void 0:$m.reattach)===!0,detachable:(gc=t.edges)==null?void 0:gc.detachable},edgeSnap:(ps=t.edges)==null?void 0:ps.snap,plugins:n,events:{[bo]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Os]:ne=>{if(this.$editable){let ze=this.$_cellMap.get(ne.dragGroup[0].vertex.id);ze!=null&&this.toFront(ze)}},[xb]:ne=>{if(this.$editable){let ze=this.$_cellMap.get(ne.dragGroup[0].vertex.id);ze!=null&&this.toFront(ze)}}},dragOptions:{filter:ne=>this.F&&this.F.canDrag?this.F.canDrag(ne.vertex,this.Lr(ne.vertex),ne.el):!0,canDrop:(ne,ze,Lt)=>this.F&&this.F.canDrop?this.F.canDrop(ne,ze,Lt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${Mo}="${this.$editable}" class="${Dy}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${Mo}="${this.$editable}" class="${Ny}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${Ny}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${Dy}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind($r,ne=>{this.Ym(ne.vertex,ne.el)}),this.$ui.bind(Gr,ne=>{this.Ym(ne.vertex,ne.el)}),this.model.bind(Re,ne=>{this.Xm(ne.node)}),this.model.bind(Me,ne=>{this.Xm(ne.group)}),this.model.bind(Wt,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}ob(r){var h,d,u,p,m,g,E,y,x,f,b,A,T,S,R;let e=(h=r.edges)!=null&&h.events?r.edges.events[Ye]:null,t={events:{[Ye]:v=>{let _=v.e.srcElement||v.e.target;if(sn(_,Ks)){he(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().ee.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(m=r.edges)==null?void 0:m.deleteButton,deleteButtonClass:(g=r.edges)==null?void 0:g.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==Ye&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>_=>{this.$editable&&this.toFront(this.$_cellMap.get(_.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||_.model.getSelection().de.length<1||_.e.shiftKey!==!0?_.model.setSelection(_.obj):_.model.addToSelection(_.obj)),v&&v(_)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Lr(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Lr(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(R=r.cells)==null?void 0:R.nodes,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}Ym(r,e){r.data.z==null&&(r.data.z=aw(this.$_cellList)+1);let t=new Yn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}Xm(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}tb(r,e){let t=this.Lr(r);return t==null?!0:this.F&&this.F.canRotate?this.F.canRotate(r,t,e):!0}rb(r,e){let t=this.Lr(r);return t==null?!0:this.F&&this.F.canLink?this.F.canLink(r,t,e):!0}ib(r,e){let t=this.Lr(r);return t==null?!0:this.F&&this.F.canClone?this.F.canClone(r,t,e):!0}eb(r,e){let t=this.Lr(r);return t==null?!0:this.F&&this.F.canResize?this.F.canResize(r,t,e):!0}nb(r,e){let t=this.Lr(r);return t==null?!0:this.F&&this.F.canDelete?this.F.canDelete(r,t,e):!0}Lr(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}sb(r){return X(r)?r:r.id}jh(r){return X(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new Yn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new Ei(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof Yn&&(e.source=e.source.id),e.target instanceof Yn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new Ei(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Aa(this.$ui,r).svg}exportImage(r,e){Vp(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.sb(r))}toFront(r){if(!(r instanceof Ei)){let e=this.jh(r),t=aw(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}toBack(r){if(!(r instanceof Ei)){let e=this.jh(r),t=AG(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}selectCell(r){let e=this.jh(r);this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(X(r)?r:r.id);this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof Ei?r.edge:r;aP(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){aP(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(aP(this.$ui)){let e=r instanceof Ei?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:Bn.type,options:r})}attachPalette(r,e){return new Yh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function SG(i,r,e){return new Yh(r,i,e)}function TG(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||ve,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||Ne,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||Q,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||Ee,selectionMode:nd});let o=hn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var lP=class extends Sa{constructor(r,e,t){super(r,e.$ui,t)}};function vG(i,r){gp.register(i,r)}function CG(i,r,e){return hn(e||{}).render(i,r)}var PG=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e||lw,r)},_G=(e=>(e.idle="idle",e.dragging="dragging",e))(_G||{}),AC="assigned",Oa="added";function hw(i){return X(i)?{id:i,active:!0,membership:Oa}:{id:i.id,active:i.active,membership:i.membership}}var OG=z(ih);function RG(i,r){let e=Hm(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var LG=["input","textarea","select","button","option"],lw=LG.join(","),nm=class{constructor(r){c(this,"inputFilterSelector");c(this,"wr",{});c(this,"Hh",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"kh");c(this,"O");c(this,"Wh");c(this,"co");c(this,"u");c(this,"_");c(this,"ye");c(this,"Dr");c(this,"Js");c(this,"Zh");c(this,"se");c(this,"Ks",[]);c(this,"Jh");c(this,"uo");c(this,"qs",null);c(this,"At",[]);c(this,"currentState","idle");c(this,"R");c(this,"an",{});c(this,"Kh",{});c(this,"jt",null);c(this,"xe",new Map);c(this,"po",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||lw;let e=`${be(te)}, ${be(te)} *`;this.draggableInstance.addDragHandler({selector:e,start:t=>this.ab(t),drag:t=>this.lb(t),stop:t=>{this.hb(t)},constrainFunction:(t,n,o,s,a,l)=>t,destroy:()=>this.$destroy()}),this.ui.bind(ei,t=>{this.currentState==="dragging"&&(this.co=this.co*(t.zoom/this.Wh),this.Wh=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&(this.R=new pi(this.draggableInstance,{autoPanDelta:this.draggableInstance.dragOptions.autoPanDelta||5,autoPanRepeat:this.draggableInstance.dragOptions.autoPanRepeat||15,onPan:t=>{this.O=Object.assign({},t),this.jm(!1)},shouldHandle:()=>this.kh!==!0}))}qh(r){for(let e in this.wr){let t=this.wr[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&mn(r)){r.mo=e||$();let n=r.mo;this.wr[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.mo:r;delete this.wr[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return $t(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(Tt).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return sn(l,o)};s.cb=o,this.addDragFilter(s,t,e)})}))}db(r){for(let e in this.wr)if(this.wr[e].cb===r){delete this.wr[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(Tt).forEach(n=>{this.db(n)})}))}clearAllFilters(){this.wr={}}le(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.se&&this.se.cleanup(),this.se=null,this.Zh=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,gt),F(this.ui.rootElement,vf),this.uo||(F(this.ui.rootElement,lh),F(this.ui.rootElement,Er),F(this.ui.rootElement,fr)),this._!=null&&F(this._.el,Cf),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(OG)).forEach(r=>{F(r,ih)}),L(this.u.el,ih),F(this.u.el,nh),this.xe.forEach(r=>{F(r.managedElement.el,nh),L(r.managedElement.el,ih)})),this.currentState="idle",this.u=null,this._=null,this.Hm(),this.Ks.forEach(r=>{this.km(r.managedElement,Er,Lf,lh)}),this.Ks.length=0,this.po.clear(),this.xe.clear(),this.jt=null}Hm(){this.At.forEach(r=>{this.km(r.managedElement,fr)}),this.At.length=0}ub(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Wm(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}pb(r){r=r||0;let e=-r*Math.PI/180;return{cos:Math.cos(e),sin:Math.sin(e)}}ab(r){if(r.e.mb==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(this.R&&this.R.reset(),this.qs=null,!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(gr)!==ct)if(this.qh(r.e)&&PG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Bt(r.el,be(mt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!rt(t.obj)&&!H(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.xe.clear(),this.Jh=!0,r.e.mb=!0,this.u=this.ub(t.obj,r.e),this.u==null)return r.e.Sy=!0,!1;this.Js=!1,this.ye={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.O={x:0,y:0},this.kh=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this.Dr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Dr=this.ui.getGroupDefinition(this._.modelObject),this.Dr.elementsDraggable===!1)return!1;s=this.Dr.elastic===!0&&r.e.shiftKey!==!0,this.Zh=r.e.shiftKey===!0,this.ye=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,Cf),this.Jh=this.ui.$canDrop(this.u.modelObject,null,!0),s||(F(this.ui.rootElement,Er),L(this.ui.rootElement,lh)),this.qs=this.pb(this._.r)}this.uo=o||s,this.uo||L(this.ui.rootElement,Er),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!Xe(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),m=this.ui.$_getGroupContentAreaInfo(l.id),E=-(p.r||0)*Math.PI/180,y={droppable:u,managedElement:p,depth:Cc(l),contentAreaInfo:m,contentArea:p.contentArea,contentBox:{x:p.x+m.internalOffset.x,y:p.y+m.internalOffset.y,width:p.width-m.internalOffset.x,height:p.height-m.internalOffset.y,r:p.r},isCurrentGroup:d,group:l,id:l.id,rotation:p.r||0,rotationMatrix:{cos:Math.cos(E),sin:Math.sin(E)}};this.Ks.push(y),u?(d||this.kn(p,Er),d&&this.kn(p,Lf)):this.kn(p,lh)}}):s&&(this.se=new ya(this.ui,this.u.modelObject,this.u.modelObject.group,this.Dr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.gb(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.Wh=this.draggableInstance.getZoom(),this.co=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,gt),L(this.ui.rootElement,vf),L(this.u.el,nh),this.currentState="dragging",this.R&&this.R.observe(this.u.el),this.jt=this.an[this.u.modelObject.id],this.jt&&!RG(this.jt,this.u.modelObject.id)&&(this.jt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.po.clear(),this.xe.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:kn(this.u),originalPosition:Nt(this.u),position:Nt(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.jt!=null){let l=(Y(this.u.modelObject)?xs(this.u.modelObject):[]).map(d=>d.id),h=En(this.u.modelObject).map(d=>d.id);Array.from(this.jt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.xe.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:kn(d.el),originalPosition:Nt(d.el),position:Nt(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.R&&this.R.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,nh),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Os,a),!0}else return!1;else return!1}else return!1;else return!1}}Gl(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.R!=null&&(this.R.unobserve(this.u.el),this.xe&&this.xe.forEach(r=>{this.R.unobserve(r.managedElement.el)}))}kn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}km(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}hb(r){var e;if(this.Gl(),this.u!=null&&this.newPosition!=null){this.Eb(),this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y},d=Object.assign({},h);if(this.At.length>0&&(o=this.At[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.Zh&&t.delete(o.group))),o==null){if(!this.Jh)return this.Zm();this._!=null&&this.se==null&&(d.x+=this._.x+this.ye.internalOffset.x,d.y+=this._.y+this.ye.internalOffset.y,d=De(d,this._.c,this._.r)),n[this.u.id]={x:d.x,y:d.y},Array.from(this.xe.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.Zm();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let m=d.x+(this._.x+this.ye.internalOffset.x),g=d.y+(this._.y+this.ye.internalOffset.y);d.x=m-(o.managedElement.x+p.internalOffset.x),d.y=g-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d=this.fb(this.u,o.managedElement,p),n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.jt!=null){let m=this.yb(d,o.managedElement,p);for(let g in m.current){let E={x:Math.floor(m.current[g].x),y:Math.floor(m.current[g].y)};n[g]=E;let y=this.xe.get(g),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.po.forEach((p,m)=>{n[m]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let m in p.current)n[m]=p.current[m]}this.ui.model.transaction(()=>{if(a)this.xe.forEach((p,m)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},m={};if(o==null)if(this.se==null)Array.from(this.xe.values()).forEach(g=>{g.parentGroup!=null&&(t.add(g.parentGroup.modelObject),this.ui.model.$removeFromGroup(g.modelObject,null,{x:this.relativePositionAtDown.x+g.offset.x,y:this.relativePositionAtDown.y+g.offset.y},g.position,this.ui))});else{let{movedElements:g,resizedGroups:E}=this.se.Wl();Object.assign(m,E);for(let y in g)n[y]=g[y].current,p[y]=g[y].current}else l.forEach(g=>{this.ui.model.$addToGroup(g.vertex,o.group,g.originalParent,g.originalPosition,g.positionInGroup,this.ui)});for(let g in n){let E={[this.ui.$modelLeftAttribute]:n[g].x,[this.ui.$modelTopAttribute]:n[g].y};m[g]!=null&&(E[this.ui.$modelWidthAttribute]=m[g].newGroupSize.width,E[this.ui.$modelHeightAttribute]=m[g].newGroupSize.height),this.ui.model.$_updateVertex(g,E,$s,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(m)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.xe.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let m=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:m.el,vertex:p.modelObject,element:m})}}),this.ui.$stopMotion(),this.ui.fire(Mt,u)}this.le()}fb(r,e,t){let n=De(De(r,r.c,r.r+e.r),e.c,-e.r);return{x:n.x-(e.x+t.internalOffset.x),y:n.y-(e.y+t.internalOffset.y)}}yb(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.jt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.xe.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.xe.get(h.id).size;return new Oi({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}Zm(){this.ui.$stopMotion(),Array.from(this.xe.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.po.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(td),this.le()}xb(r){return this._==null||r.id===this._.id}jm(r){if(this.newPosition!=null){let e={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y};this.Hm();let t={x:e.x+this.ye.pageOrigin.x,y:e.y+this.ye.pageOrigin.y,width:this.u.width,height:this.u.height,r:this.u.r};if(this.Ks.forEach(l=>{Px(l.contentBox,t)&&this.At.push(l)}),this.At.length>0){this.At.sort((h,d)=>h.depth>d.depth?-1:1),this.Qh(this.At[0].managedElement,!0);let l=!this.xb(this.At[0].managedElement);(this._==null||this.Js||l)&&this.kn(this.At[0].managedElement,fr),this._!=null&&!l&&(this.Js=!0,this.kn(this._,Er)),this.uo||F(this.ui.rootElement,fr)}else this.Qh(this._,!1),this._!=null&&!this.Dr.elastic&&(this.Js=!0,this.kn(this._,Er)),this.uo||L(this.ui.rootElement,fr);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.xe.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=ae(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.po.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.ye.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(nr,s),{redrawResult:a,positions:n}}}Jm(r,e,t){if(e==null)this.ui.$setVisibleElementRotation(r,r.r);else{let n=0;t?n=r.modelObject.group===e.modelObject?0:e.r:n=r.modelObject.group===e.modelObject?-e.r:0,this.ui.$setVisibleElementRotation(r,r.r+n)}}Qh(r,e){this.u!=null&&(this.Jm(this.u,r,e),Array.from(this.xe.values()).forEach(t=>{t.managedElement.id!==this.u.id&&this.Jm(t.managedElement,r,e)}))}Eb(){this.Qh(null,!0)}Ab(r,e){if(this.qs==null)return{x:r,y:e};let{cos:t,sin:n}=this.qs;return{x:r*t-e*n,y:r*n+e*t}}lb(r){if(this.currentState==="dragging"){he(r.e),this.kh=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.co,n=(e.y-this.downAt.y)/this.co,o=this.Ab(t,n);t=o.x,n=o.y;let s={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(s.x-=this.ye.pageOrigin.x,s.y-=this.ye.pageOrigin.y,!this.Dr.elastic&&this.Dr.constrain&&(s.x+this.u.width>this._.width-this.ye.internalOffset.x&&(s.x=this._.width-this.u.width-this.ye.internalOffset.x),s.y+this.u.height>this._.height-this.ye.internalOffset.y&&(s.y=this._.height-this.u.height-this.ye.internalOffset.y),s.x<0&&(s.x=0),s.y<0&&(s.y=0))),this.activeGrid!=null&&(s=ae(s,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(s=this.draggableInstance.dragOptions.constrainFunction(s,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=s;let a=this.jm(r.e.shiftKey);if(this.R!=null&&this.u!=null){let l=this.u.el.getBoundingClientRect();this.R.updateDragElementPosition(l)}return this.se!=null&&this.se.focusVertex.id===this.u.id&&this.Sb(r.e,a.positions[this.u.id]),a.redrawResult}else return null}gb(){let r=this._?this._.x+this.ye.internalOffset.x:0,e=this._?this._.y+this.ye.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}Km(r,...e){let t=[],n=hw(r),o=this.Kh[n.id];if(o==null)o={id:n.id,members:new Set},this.Kh[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Oa)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Wm(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.an[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.an[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.an[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.an[t.id];if(n!=null){let o=Hm(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.Kh[r];e!=null&&(e.members.forEach(t=>{delete this.an[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.an[r]}Sb(r,e){this.se!=null&&e!=null&&this.se.setFocusPosition(e,!0,r)}Wm(r,e){for(let t=0;t<this.Hh.length;t++)if(!this.Hh[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.Hh.push(r)}$destroy(){this.R&&this.R.disconnect()}};var br=i=>i.map(r=>String.fromCharCode(r)).join(""),wG=new Date().getFullYear(),DG=br([67,111,112,121,114,105,103,104,116,32])+wG+br([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),hP=br([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),cw=new Array(50).fill("-").join(""),NG=br([86,105,115,117,97,108,108,121,74,115,32])+Bg,IG=br([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),MG=br([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),VG=br([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Ra=br([10,10]),dw=cw+Ra+NG+Ra+DG+Ra+hP+Ra+IG+Ra+MG+Ra+VG+Ra+cw,uw=br([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),GG=br([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,56,48,34,32,104,101,105,103,104,116,61,34,51,48,34,62]),pw=br([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),$G=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],BG=pw+'<path d="'+$G.join('"/><path d="')+'"/></g>',FG=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],UG=pw+'<path d="'+FG.join('"/><path d="')+'"/></g>',mw=GG+BG+"<g>"+br([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+UG+br([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),YG=br([60,97,32,104,114,101,102,61,34])+hP+br([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+uw+'">'+mw+"</a>",cP=null;function im(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),im(i,!0,s)};r||console.log(dw),cP&&window.clearInterval(cP),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(YG,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",hP),s.setAttribute("target","_blank"),s.setAttribute("title",uw),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),cP=window.setInterval(()=>a(),25e3)}}var dP=null;function uP(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),uP(i,!0,n)};r||console.log(dw),dP&&window.clearInterval(dP),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(mw,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((m,g)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),dP=window.setInterval(()=>u(),25e3)}}var pP="vjs-orthogonal-handle",om="vjs-orthogonal-segment-drag",mP="vjs-orthogonal-segment-drag-ns",gP="vjs-orthogonal-segment-drag-ew";var zG=10,XG=20,no=class extends Qi{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+om+" *",target:"."+om,drag:n=>{let o=n.el.Ht,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=xS(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Ht,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.qm(!0),this.$updateModel(Ur(n.el.Ht.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=Ur(n.el.Ht.connection.connector)}})}Qm(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;we(e.el,{x:o,y:s})}$repaint(e){this.yn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],ks(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.Qm(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.yn(),this.currentConnector.edited=!0}$elementDragged(e){this.qm(!0)}$elementDragging(e){this.$repaint()}yn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===Rc,d=this.$makeOrthogonalHandle(h,a,l,XG,zG,[Gn,pP,om,h?gP:mP].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Ht=u,this.segmentHandles.push(u),this.Qm(u,s)}else o===n&&this.segmentHandles.push(t)}}qm(e){this.current&&this.$hasEdits&&(bS(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(no,"type",Hs);Rr.set(no.type,no);function EP(){Rr.set(no.type,no)}var zh="vjs-straight-handle",ls="vjs-straight-segment-drag",sm="vjs-straight-segment-split",am="vjs-straight-segment-delete",fP="vjs-straight-editor-guideline";var lm=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(z(sm)).Ht;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(z(am)).Ht;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,z(sm),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,z(am),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Gn,zh,sm].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Gn,zh,am].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var My="vjs-straight-connector-edit",yP="click",jG="auto";var Vy=class{constructor(r){this.editor=r;c(this,"ec");c(this,"tc");c(this,"$segmentToDrag");c(this,"$pageEvent");this.ec=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=me(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);he(e.e);let o=eS(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.tc=(e=>{let t=e.target.closest(z(ls)).Ht;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Hr(r,My),this.editor.ui.bind(yl,this.ec),this.editor.ui.on(this.editor.ui.getContainer(),W,`${z(ls)} *`,this.tc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(yl,this.ec),this.editor.ui.off(this.editor.ui.getContainer(),W,this.tc),this.editor.current!=null&&Pr(this.editor.current,My)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],pe,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var io=class extends Qi{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===yP?new lm(this):new Vy(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+ls+" *",target:"."+ls,drag:n=>{let o=n.el.Ht,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(Ur(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=Ur(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(Ur(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(Ur(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Gn,zh,ls].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Ht=l),this.segmentHandles.push(l)}this.Tb()}this.$mode.$repaintEnded()}Tb(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=G(Pe,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[fP,Sp].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=G(ee,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(io,"type",_n);Rr.set(io.type,io);function xP(){Rr.set(io.type,io)}var Xh="vjs-bezier-handle",Gy="vjs-bezier-handle-control-point",bP="vjs-bezier-handle-control-point-1",AP="vjs-bezier-handle-control-point-2",SP="vjs-bezier-guideline";var fi=class extends Qi{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"bt");c(this,"Fe");c(this,"kt");c(this,"rc");c(this,"nc");c(this,"eg",{x:0,y:0});c(this,"tg",{x:0,y:0});this.bt=t.handleSize||kp,this.$addDragHandler({selector:"."+Xh+" *",target:"."+Xh,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Fe:this.kt,h=a===0?this.eg:this.tg;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.eg=Object.assign({},this.Fe),this.tg=Object.assign({},this.kt),!0)})}$activate(e,t){this.rg(),this.ng(),this.vb((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.rg(),this.ng(),this.ig(),this.Cb()}vb(e){this.h1=this.$makeAndAppendCircularHandle(this.Fe.x,this.Fe.y,this.bt,this.bt,[Gn,Xh,Gy,bP].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.kt.x,this.kt.y,this.bt,this.bt,[Gn,Xh,Gy,AP].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Cr,this.lockHandles||(this.h2.style.display=Cr),this.l1=this.og(this.rc,this.Fe.x,this.Fe.y),this.l2=this.og(this.nc,this.kt.x,this.kt.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Cr:pt,this.l2.style.display=e?Cr:pt,this.ig()}ig(){this.$setElementPosition(this.h1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.kt;this.$setElementPosition(this.h2,e.x,e.y)}og(e,t,n){let o=G(Pe,{width:5,height:5}),s=G(ee,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,SP),this.ui.$addClassToElement(o,Sp),this.ic(e,o,t,n),o}Cb(){this.ic(this.rc,this.l1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.kt;this.ic(this.nc,this.l2,e.x,e.y)}ic(e,t,n,o){an(t,e);let s=n-e.x,a=o-e.y;de(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}ng(){this.currentConnector&&(this.Fe=this.currentConnector.geometry.segments[0].cp1,this.kt=this.currentConnector.geometry.segments[0].cp2)}rg(){this.current&&(this.rc={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.nc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(fi,"type",Oo);var oo=class extends fi{constructor(r,e){super(r,e),this.lockHandles=!0}};c(oo,"type",Kd);Rr.set(fi.type,fi),Rr.set(oo.type,oo);function TP(){Rr.set(fi.type,fi),Rr.set(oo.type,oo)}var gw="selected-vertices",jh=class extends aa{constructor(e,t,n,o,s){var h,d,u,p,m,g,E,y,x;super(e,t,n,o,s,gn(o.defaults||{},{managedElementsSelector:be(mt,rn)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"Wn");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"oc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"sg");c(this,"mode",xr);if(this.Wn=Rv(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.pA=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Zr(Vt,Pe,{position:"absolute",left:"0",top:"0"},xf,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Zr(Vt,Pe,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Zr(Vt,q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Zr(Vt,q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Zr(Vt,q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Zr(null,Ze,{position:"relative",width:zr,height:zr},xf,{},this.rootElement,!0),this.vertexLayer=Zr(null,Ze,{left:0,top:0,position:"absolute",width:zr,height:zr},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Zr(Vt,Pe,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),im(this.rootElement,!1),this.oc=o.elementsDraggable!==!1,this.oc===!1&&this.canvasElement.setAttribute(TS,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new nm({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new ma(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(pa),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||In),this.sg=new bp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Dl:f=>{L(this.rootElement,Nn)},Ml:f=>{F(this.rootElement,Nn)},Nl:f=>{},Il:f=>{F(this.rootElement,Nn)}}),new Ap({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.sg}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(du),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,ff),Ln()&&L(this.rootElement,jT),li()&&L(this.rootElement,HT),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,yf);let a=(f,b,A)=>{let T=S=>{let R=S.srcElement||S.target;if(R===this.rootElement||R===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(R)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===bo&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,bo,bt),a(Br,eA),this.panZoom=new da({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>we(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.k(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(m=o.pan)==null?void 0:m.useMetaKey,wheel:this.Pb(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(g=o.pan)==null?void 0:g.filter,events:{panStart:()=>{L(this.rootElement,Tf),L(document.body,gt)},[xl]:(f,b,A,T,S)=>{this.fire(xl,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[ei]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(ei,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[se]:()=>{F(this.rootElement,Tf),F(document.body,gt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,z(uu),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.Tu(o),this.$dataLoadStart();let l=this.au();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}Ob(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{we(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===ft&&(d=d||et(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||et(n),h-=d.height),we(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.Wn.length;t++)this.Ob(this.Wn[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}$u(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.oc!==!1&&(this.mode===xr||this.mode===mi)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.xs(le.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.xs(ie.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}Pb(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.Wn.length;e++)this.Wn[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.ie(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,EP(),xP(),TP()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.Km(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),K(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.Km({id:gw,active:!0,membership:Oa},t)}}$deselect(e){if(super.$deselect(e),K(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(gw)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}addVertexDragFilter(e){this.elementDragHandler.$addVertexDragFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=X(e)?{id:e,active:!0,membership:Oa}:Object.assign(e,{membership:Oa});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:Bn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.Za.length;t++)try{e=this.Za[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,ff),F(this.rootElement,XT),F(this.rootElement,yf),this.ie(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Di,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=X(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new Ff(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.Wn.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}centerOnAndZoom(e,t,n){let o=this.getObjectInfo(e,!1);o.el!=null&&this.panZoom.centerOnAndZoom({bounds:this.viewport.getElementBounds(o.id),fillRatio:t,doNotAnimate:n})}centerOn(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOn({bounds:this.viewport.getElementBounds(t.id)})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.ag=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.ag!=null&&this.off(this.vertexLayer,e,t.ag)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=Ke,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[xr]:()=>{this.panZoom.setEnabled(!0)},[mi]:()=>{this.panZoom.setEnabled(!1)},[Ko]:()=>{this.panZoom.setEnabled(!1)},[Vn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===mi&&!t&&this.model.clearSelection(),this.fire(Tn,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(jh,"type","Surface");var $y=class extends Od{fetchUrl(r){na(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?ha:la,o=t||Ah(n,e==null?void 0:e.useSvgContainer,e);return fw(this,r,o,e)}renderDiagram(r,e){return new rm(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?ha:la,s=n||Ah(o,e==null?void 0:e.useSvgContainer,{});return yw(this,r,s,e,t)}};function hn(i){return i=i||{},new $y(i)}function HG(i,r){i.bind(Zt,e=>{r.$nodeAdded(e)}),i.bind(kt,e=>{r.$groupAdded(e)}),i.bind(Re,e=>{r.$nodeRemoved(e)}),i.bind(Me,e=>{r.$groupRemoved(e)}),i.bind(hr,e=>{r.$edgeAdded(e)}),i.bind(xt,e=>{r.$edgeRemoved(e)}),i.bind(bn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function fw(i,r,e,t){return Ew(i,r,e,(n,o,s,a,l)=>new jh(n,s||n,a,o,l),t)}function Ew(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new cr(i,{generator:s.selection}));let a=s.id||$(),l=t(i,s,o,r,e);return o!=null&&HG(o,l),i.$addRenderer(l,a),l}function yw(i,r,e,t,n){return Ew(i,r,e,(o,s,a,l,h)=>new Hh(o,a||o,l,s,h,n),t)}var kG=i=>i.map(r=>String.fromCodePoint(r)).join(""),WG=[99,114,101,97,116,101,69,108,101,109,101,110,116];function ZG(){return document}var xw=i=>ZG()[kG(WG)](i);var Hh=class extends aa{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");this.id=o.id||$(),this.$margin=o.margin||NT,this.$horizontalAlign=o.horizontalAlign||o.align||jo,this.$verticalAlign=o.verticalAlign||o.align||jo,o.useSvgContainer?this.$canvas=G(Pe,{width:"100%",height:"100%"}):(this.$canvas=xw("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,wT),L(this.$canvas,DT),n.appendChild(this.$canvas),this.setContainer(this.$canvas),im(this.rootElement,!1),this.bindAll([An,Ms,Mt,Vr,Re,Me,$r,Gr,Sn,Db,Is],()=>{this.syncView()}),this.Tu(o),this.$dataLoadStart();let h=this.au();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.je,t=et(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h),u=n*d,p=o*d;if(Rt(this.$canvas)){let m=0,g=0;switch(this.$horizontalAlign){case jo:break;case ql:m-=(s-d*n)/2;break;case Ql:m+=(s-d*n)/2;break}switch(this.$verticalAlign){case jo:break;case ql:g-=(a-d*o)/2;break;case Ql:g+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${m}, ${g})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let m=(-e.xmin+this.$margin)*d,g=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case ql:break;case jo:m+=(s-u)/2;break;case Ql:m+=s-u;break}switch(this.$verticalAlign){case ql:break;case jo:g+=(a-p)/2;break;case Ql:g+=a-p;break}let E=`translateX(${m}px) translateY(${g}px) scale(${d})`;this.$canvas.style.transform=E}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return console.log("toPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromPageLocation(e,t,n){return console.log("fromPageLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}fromWindowLocation(e,t,n){return console.log("fromWindowLocation not necessarily correct - implement in base browser ui"),{x:e,y:t}}mapEventLocation(e){return console.log("mapEventLocation not necessarily correct - implement in base browser ui"),this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=et(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}getApparentCanvasLocation(){return console.log("paper get aparent canvas loc - is it correct to return 0,0?"),{x:0,y:0}}addBackground(e){console.log("add background to paper - what needs to happen?")}removeBackground(e){console.log("remove background from paper - what needs to happen?")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function JG(i,r,e,t){let n=hn(e||{}),o=r!=null&&r.useSvgContainer?ha:la,s=Ah(o,r==null?void 0:r.useSvgContainer,{}),a=new Hh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function KG(i,r,e){if($t(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if($t(t,e,i))return t;t=t.parentNode}}}function qG(i){return typeof i=="function"?(i.mo=$(),i.mo):i}function QG(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=KG(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=$t(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var _P="start",OP="beforeStart",RP="drag",Sw="drop",Tw="over",vw="out",LP="stop",bw="katavorio-draggable",e$=bw,t$=10,r$=10,vP=function(){return!0},n$=function(){return!1},CP={delegatedDraggable:"katavorio-delegated-draggable",draggable:e$,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},Aw=[LP,_P,RP,Sw,Tw,vw,OP],i$=function(){},kh=function(i,r){if(i!=null){i=!X(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},o$=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e.getInputFilterSelector(),r)},PP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",$());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};kh(this.scopes,t=>{e[t]=!0}),kh(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};kh(this.scopes,t=>{e[t]=!0}),kh(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};kh(this.scopes,t=>{e[t]=!0}),kh(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},Cw="notNegative",Pw="parent",_w="parentEnclosed";function wP(i,r){let e=null;switch(i){case Cw:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case Pw:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case _w:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var By=class extends PP{constructor(e,t,n){super(e,n);c(this,"lg");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"K");c(this,"_e");c(this,"xt");c(this,"Qs");c(this,"ea",{x:0,y:0});c(this,"go",{x:0,y:0});c(this,"Ke");c(this,"ta");c(this,"ra");c(this,"E");c(this,"sc");c(this,"Eo");c(this,"fo");c(this,"Zn",!1);c(this,"na");c(this,"Jn");c(this,"lc");c(this,"$");c(this,"yo",[]);c(this,"hg");c(this,"cg");c(this,"Pn");c(this,"Cr");c(this,"hc");c(this,"xo",{});c(this,"ia");c(this,"be");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.lg=this.manager.css.draggable,L(this.el,this.lg),this.downListener=this.qr.bind(this),this.upListener=this.yr.bind(this),this.moveListener=this.Qr.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.hg=t.canDrag||vP,this.cg=t.consumeFilteredEvents,this.Pn=t.parent,this.Cr=t.ignoreZoom===!0,this.na=t.ghostProxyParent,this.hc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this._b.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.Jn=vP:t.ghostProxy&&typeof t.ghostProxy=="function"?this.Jn=t.ghostProxy:this.Jn=(o,s)=>this.$&&this.$.useGhostProxy?this.$.useGhostProxy(o,s):!1,t.makeGhostProxy?this.lc=t.makeGhostProxy:this.lc=o=>this.$&&this.$.makeGhostProxy?this.$.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(bw);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.yo.push(t)}this.eventManager.on(this.el,pe,this.downListener)}_b(e){if(this.xt){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.ea.x,o=t.y-this.ea.y,s={x:n+this.Qs.x,y:o+this.Qs.y},a=s.x-this.K.x,l=s.y-this.K.y,h=this.Cr?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.go.x,l+=this.E.parentNode.scrollTop-this.go.y),a/=h,l/=h,this.moveBy(a,l,e),this.Qs=s,this.ea=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}yr(e){this.K&&(this.K=null,this.eventManager.off(document,oe,this.moveListener),this.eventManager.off(document,se,this.upListener),this.unmark(e),this.stop(e),this.xt=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.$&&this.$.revertFunction&&this.$.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this._e))}qr(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.hg())if(this.qh(e)&&o$(e,this.el,this.manager)){this.$=null,this.be=null,this.yo.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=QG(this.yo,this.el,o);if(s!=null&&(this.$=s[0],this.be=s[1]),this.$==null||this.be==null)return;let a=this.$.dragInit?this.$.dragInit(this.be,e):null;a!=null&&(this.be=a);let l=1;if(this.clone)if(this.E=this.be.cloneNode(!0),L(this.E,CP.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.Pn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.Pn.appendChild(this.E)}else{let h=ki(this.be,!0),d=this.be.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.hc&&!this.Cr&&(l=this.hc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.be;this.consumeStartEvent&&he(e),this.K=me(e),this.E&&this.E.parentNode&&(this.go={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this._e=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),this.Ke.width=this.Ke.width*l,this.Ke.height=this.Ke.height*l,this.eventManager.on(document,oe,this.moveListener),this.eventManager.on(document,se,this.upListener),this.oa(OP,{el:this.el,pos:this._e,e,drag:this,size:this.Ke})}else this.cg&&he(e)}Qr(e){if(this.K){if(!this.xt){let t=this.oa(_P,{el:this.el,pos:this._e,e,drag:this,size:this.Ke});if(t!==!1){if(!this.K)return;this.mark(t),this.xt=!0}else this.abort()}if(this.K){let t=me(e),n=t.x-this.K.x,o=t.y-this.K.y,s=this.Cr?1:this.manager.zoom;this.Qs={x:t.x,y:t.y},this.ea={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.go.x,o+=this.E.parentNode.scrollTop-this.go.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this._e!=null&&this.K!=null?{x:this.K.x-this._e.x,y:this.K.y-this._e.y}:{x:0,y:0}}mark(e){this._e=this.manager.positionGetter(this.E),this.Ke=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.ia=this.manager.getParentConstrainingRectangle(this.E),this.Eo=0,this.fo=0}unmark(e){this.Zn&&this.Jn(this.be,this.E)?(this.sc={x:this.E.offsetLeft-this.Eo,y:this.E.offsetTop-this.fo},this.E.parentNode.removeChild(this.E),this.E=this.be):this.sc=null,F(this.E,this.manager.css.drag),this.Zn=!1}moveBy(e,t,n){let o=this.toGrid({x:this._e.x+e,y:this._e.y+t}),s=this.Rb(o,this.E,this.ia,this.Ke,{x:this._e.x,y:this._e.y},n);if(s!=null){if(this.Jn(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.Zn){let a=this.lc(this.be);L(a,CP.ghostProxy),this.na?(this.na.appendChild(a),this.ta=ki(this.be.parentNode),this.ra=ki(this.na),this.Eo=this.ta.x-this.ra.x,this.fo=this.ta.y-this.ra.y):this.be.parentNode.appendChild(a),this.E=a,this.Zn=!0}s=o}else this.Zn&&(this.E.parentNode.removeChild(this.E),this.E=this.be,this.Zn=!1,this.ta=null,this.ra=null,this.Eo=0,this.fo=0);this.manager.positionSetter(this.E,{x:s.x+this.Eo,y:s.y+this.fo}),this.oa(RP,{el:this.el,pos:s,e:n,drag:this,size:this.Ke,originalPos:this._e,viewport:this.ia})}}abort(){this.K!=null&&this.yr()}getDragElement(e){return e?this.be||this.el:this.E||this.el}stop(e,t){if(t||this.xt){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.Ke]),this.oa(LP,{el:this.E,pos:this.sc||o,finalPos:o,e,drag:this,selection:n,size:this.Ke,originalPos:{x:this._e.x,y:this._e.y},viewport:this.ia})}else this.xt||this.$.dragAbort&&this.$.dragAbort(this.be)}oa(e,t){let n=null;if(this.$&&this.$[e])n=this.$[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:t$/2,thresholdY:r$/2};return this.$!=null&&this.$.grid!=null&&(e.grid=this.$.grid,this.$.snapThreshold!=null&&(e.thresholdX=this.$.snapThreshold,e.thresholdY=this.$.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return ae(e,t,s,a)}}setUseGhostProxy(e){this.Jn=e?vP:n$}Rb(e,t,n,o,s,a){return this.$!=null&&this.$.constrainFunction&&typeof this.$.constrainFunction=="function"?this.$.constrainFunction(e,t,n,o,s,a):e}qh(e){for(let t in this.xo){let n=this.xo[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=qG(e);this.xo[n]=[o=>{let s=o.srcElement||o.target,a;return X(e)?a=$t(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.mo:e;delete this.xo[t]}clearAllFilters(){this.xo={}}addSelector(e,t){e.selector&&(t?this.yo.unshift(e):this.yo.push(e))}destroy(){this.eventManager.off(this.el,pe,this.downListener),this.eventManager.off(document,oe,this.moveListener),this.eventManager.off(document,se,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},s$=["input","textarea","select","button","option"],a$=s$.join(","),hm=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||a$,this.eventManager=new fe,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}Lb(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<Aw.length;t++){let n=Aw[t];e.events[n]=r[n]||i$}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.bo==null){let t=this.Lb(e),n=new By(r,t,this);return L(r,CP.delegatedDraggable),r.bo=n,n}else return r.bo}destroyDraggable(r){r.bo&&(r.bo.destroy(),delete r.bo)}};var Ow=15,Rw=10,Lw="markers",ww="lineStyle",Dw="sourceArrow",Nw="targetArrow",Iw="bothArrows",Mw="plain",Vw="dashed";function l$(i){let r=(i==null?void 0:i.arrowWidth)||Ow,e=(i==null?void 0:i.arrowLength)||Rw,t=(i==null?void 0:i.lineStyleProperty)||ww,n=(i==null?void 0:i.markersProperty)||Lw;return[{property:t,mappings:{[Mw]:{},[Vw]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[Dw]:{overlays:[{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]},[Nw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}}]},[Iw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}},{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var DP={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");DP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(DP.get(i))}};var NP=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new hm({positionGetter:o=>ln(o),positionSetter:(o,s)=>Qt(o,s),getSize:o=>et(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=wP(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function h$(i){Gw?i():IP.push(i)}var IP=[],Gw=!1,Fy=()=>{Gw=!0;for(let i=0;i<IP.length;i++)IP[i]()},MP=class{constructor(r){this.templateHolder=r;c(this,"c",0)}dg(){this.c--,this.c<=0&&Fy()}add(r){this.c++,na({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.dg()},error:e=>{this.dg()}})}ensureNotEmpty(){this.c<=0&&Fy()}},$w="_vjs_templates",c$=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById($w);if(r)Fy();else{r=document.createElement("div"),r.style.display="none",r.id=$w,document.body.appendChild(r);let e=new MP(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else Fy()};i()};c$();var Bw="vjs-test-support-container",d$=1e-11;function Fw(){let i=document.getElementById(Bw);return i==null&&(i=document.createElement("div"),i.id=Bw,document.body.appendChild(i)),i}var cm=[],u$=[];function Uy(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):Fw().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",cm.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function p$(i,r){for(let e=0;e<i.length;e++)Uy(i[e],r)}function m$(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function dm(i){m$(document.querySelectorAll(i))}function g$(){for(let i=0;i<cm.length;i++)cm[i].el.parentNode.removeChild(cm[i].el);cm.length=0,dm("circle"),dm(".vjs-node"),dm(".vjs-surface-canvas"),dm("svg"),dm(".vjs-lasso"),Fw().innerHTML=""}function E$(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function hs(i){return i.connector.canvas}function Ut(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return Ar(s,a,r)}function VP(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return Ar(n.x+r,n.y+e,t)}function Uw(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var Yy={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function f$(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return Ar(i,r)}function Yw(i,r,e){let t=i;e=e||{},e.start&&e.start(),Jr(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=f$();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",Yy),e.up&&e.up()}function zw(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);Jr(i,s);let a=Yy;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=Ar(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function Xw(i,r,e,t){let n=Uy("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function y$(i,r,e,t){let n=hn(i),o,s;if(r!=null){let l=Xw(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return u$.push(a),a}function x$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Ut(t);i.surface.trigger(t.querySelector("path"),"click",n)}function b$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Ut(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function A$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Ut(t);var o=t.querySelector("path");i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n)}function S$(i,r){let e=i.surface.getRenderedConnection(r),t=hs(e),n=Ut(t);var o=t.querySelector("path");i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,pe,n),i.surface.trigger(o,"mouseup",n)}function um(i,r,e){let t=i.surface.getRenderedConnection(r),n=hs(t),o=Ut(n);i.surface.trigger(n.querySelector("path"),e,o)}function GP(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Wh(i.surface,t,1,1)}function pm(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Jr(i.surface,t,1),Zh(i.surface,t,1)}function T$(i,r,e){zy(i,r,cn,1,e)}function v$(i,r,e){zy(i,r,"mouseover",1,e)}function C$(i,r,e){zy(i,r,"mouseout",1,e)}function zy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);Jh(i.surface,s,e,t,n)}function Wh(i,r,e=1,t=1){let n=Ut(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function jw(i,r,e=1){let t=Ut(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function Jr(i,r,e=1,t){Jh(i,r,cs,e,t)}function Zh(i,r,e=1,t){Jh(i,r,zn,e,t)}function Jh(i,r,e,t=1,n){let o=Ut(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function Xy(i,r,e,t,n,o=1){let s=Ar(t.x,t.y);n=n||{};let a=document.createEvent("MouseEvents");a.initMouseEvent(e,!0,!0,window,1,s.screenX,s.screenY,s.clientX,s.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,o||1,null),r.dispatchEvent(a)}function P$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Wh(i.surface,t,2,1)}function _$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);jw(i.surface,t,1)}function O$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Wh(i.surface,o,1,1)}function R$(i,r){Wh(i.surface,r,1,1)}function L$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");jw(i.surface,o,1)}function Hw(i,r){Jr(i.surface,r),Zh(i.surface,r)}function w$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Hw(i,o)}function D$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Jr(i.surface,o),Zh(i.surface,o),Jr(i.surface,o),Zh(i.surface,o)}function N$(i,r,e){let t=i.surface.getRenderedConnection(r),n=YE(t,e||"lbl");Wh(i.surface,n.contentElements[0],1,1)}function I$(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(hi(rn,e));o&&Wh(i.surface,o,1,1)}function $P(i,r,e,t,n,o){t=t||{};let s=i,a;Wi(e)?a=Ut(e,null,n):a=VP(i.$getCanvasElement(),e.x,e.y);let l=i.model.getAllEdges().length;t.start&&t.start(),Jr(i,r),t.down&&t.down();let h=Object.values(i.$_connMap).find(u=>u.edge.transient);if(h!=null&&s.trigger(hs(h).childNodes[0],st,a),s.trigger(document,cn,a),t.move){let u=i.model.getAllEdges().filter(m=>m.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}let d=()=>{s.trigger(document,zn,a);let u=i.model.getAllEdges()[l],p=u?i.getRenderedConnection(u.id):null;return t.up&&t.up(p),p};if(o)o(d);else return d()}function M$(i,r,e){e=e||{};let t=i;e.start&&e.start(),Jr(i,r),e.down&&e.down(),t.trigger(document,cn,Yy),t.trigger(document,zn,Yy)}function kw(i,r,e,t,n,o,s){let a=i.getObjectInfo(t,!1);if(a.el){n=n||{};let l=i.getRenderedConnection(r.id),h=e?".vjs-connector-source-drag":".vjs-connector-target-drag",d=l.connector.canvas.querySelector(h);n.start&&n.start(),Jr(i,d),n.down&&n.down();let u=Ut(a.el,null,o);i.trigger(document,"mousemove",u),n.move&&n.move(),s!=null?s(()=>{i.trigger(document,"mouseup",u),n.up&&n.up(l)}):(i.trigger(document,"mouseup",u),n.up&&n.up(l))}else throw`Cannot resolve drag element ${t}`}function BP(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Ut(r);o.trigger(r,cs,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=Ar(e+a.width/2,t+a.height/2);o.trigger(document,cn,l),n.afterMove&&n.afterMove(),o.trigger(document,se,l),n.afterUp&&n.afterUp()}function FP(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Ut(r,o);s.trigger(r,cs,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,cn,Uw(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,zn,null),n&&n.afterUp&&n.afterUp()}function Ww(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Ut(r,s);a.trigger(r,cs,p),o&&o.afterDown&&o.afterDown();for(let m=0;m<n;m++)a.trigger(document,cn,Uw(p,d,u,s)),o&&o.afterMove&&o.afterMove(m),d+=l,u+=h;a.trigger(document,zn),o&&o.afterUp&&o.afterUp()}var V$=typeof document!="undefined",jy=V$?"ontouchstart"in document.documentElement:!1,cs=jy?"touchstart":"mousedown",cn=jy?"touchmove":"mousemove",zn=jy?"touchend":"mouseup";function Ar(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function Zw(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function Jw(i,r,e,t,n,o,s){let l=i.vertexLayer.parentElement.parentElement;n!=null&&(l=i.getRenderedElement(n)),UP(i,l,r,e,t,o,s)}function UP(i,r,e,t,n,o,s){n&&n.start&&n.start();let a=i.toPageLocation(e.x,e.y),l=i.toPageLocation(t.x,t.y);a.x-=window.scrollX,l.x-=window.scrollX,a.y-=window.scrollY,l.y-=window.scrollY,Xy(i,r,cs,a,o),n&&n.down&&n.down(),Xy(i,document,cn,l,o),n&&n.move&&n.move(),s?s(()=>{Xy(i,document,zn,l,o),n&&n.up&&n.up()}):(Xy(i,document,zn,l,o),n&&n.up&&n.up())}var yi={addDiv:Uy,addDivs:p$,cleanup:g$,delta:E$,DOWN_EVENT:cs,UP_EVENT:zn,MOVE_EVENT:cn,isTouchDevice:jy,makeEvent:Ut,makeEventAt:Ar,nudgeEvent:Zw,getEdgeCanvas:hs,defaultEventManager:new fe,dragElementBy:(i,r,e,t)=>{FP(yi.defaultEventManager,i,r,e,t)},attachToSurface:i=>new mm(i.model,i),create:(i,r,e,t)=>{let n=y$(i,r,e,t);return new mm(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:Jw,lassoOnElement:UP,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=yi);function Kw(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=Ar(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),Jr(i,r),o.down&&o.down(),i.trigger(document,cn,l),o.move&&o.move(),i.trigger(document,zn,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var mm=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"dc");c(this,"consoleOutput","");this.eventManager=new fe,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this.dc==null&&(this.dc=new ma(this.surface)),this.dc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=Xw(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){Yw(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){Yw(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return hs(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;BP(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;BP(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)BP(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)FP(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){FP(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){Ww(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)Ww(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||po,null)}Kn(r){let e;if(TT(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}ug(r,e){return{sourceEl:this.Kn(r),targetEl:this.Kn(e)}}dragConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.ug(r,e);return $P(this.surface,s,a,t,n,o)}dragAndAbortConnection(r){M$(this.surface,this.Kn(r))}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.ug(r,e);return Kw(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.Kn(r);return $P(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.Kn(e);return $P(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.Kn(e);return Kw(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return zw(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return zw(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n,o){kw(this.surface,r,!1,e,t,n,o)}relocateEdgeSource(r,e,t,n,o){kw(this.surface,r,!0,e,t,n,o)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Ut(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?VP(r,n,o,t):Ut(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=VP(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Ut(n.el);return e||t?Zw(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return Ar(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){GP(this,r)}clickOnNode(r){GP(this,r)}clickOnVertex(r){GP(this,r)}dblClickOnVertex(r){_$(this,r)}rightClickOnVertex(r){P$(this,r)}tapOnVertex(r){pm(this,r)}tapOnNode(r){pm(this,r)}tapOnGroup(r){pm(this,r)}dblTapOnVertex(r){pm(this,r),pm(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){T$(this,r,e)}mouseoverOnVertex(r,e){v$(this,r,e)}mouseoutOnVertex(r,e){C$(this,r,e)}contextmenuOnVertex(r,e){zy(this,r,bt,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)Jr(this.surface,this.canvas,e),Zh(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){Jr(this.surface,this.canvas,t,{x:r,y:e}),Zh(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){Jh(this.surface,this.canvas,cn,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){Jh(this.surface,this.canvas.parentNode,cs,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){Jh(this.surface,this.canvas,zn,1,{x:r,y:e})}lasso(r,e,t){Jw(this.surface,r,e,t)}lassoOnElement(r,e,t,n){UP(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){R$(this,r)}clickOnElementInsideVertex(r,e){O$(this,r,e)}dblClickOnElementInsideVertex(r,e){L$(this,r,e)}tapOnElement(r){Hw(this,r)}tapOnElementInsideVertex(r,e){w$(this,r,e)}dblTapOnElementInsideVertex(r,e){D$(this,r,e)}mousedownOnElement(r){Jr(this.surface,r)}clickOnEdge(r){x$(this,r)}dblClickOnEdge(r){b$(this,r)}tapOnEdge(r){let e=rt(r)?r.id:r;A$(this,e)}dblTapOnEdge(r){let e=rt(r)?r.id:r;S$(this,e)}pg(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),m=p.x,g=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(m+13)*s,f=(g+13)*s,b=m+a*s+u.width/2,A=g+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=Ar(E,y);this.surface.trigger(h,yi.DOWN_EVENT,T),t&&this.surface.trigger(h,yi.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,yi.MOVE_EVENT,Ar(x,f));let S=Ar(b,A);if(this.surface.trigger(d,yi.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let R=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(R,yi.DOWN_EVENT,S),this.surface.trigger(R,yi.UP_EVENT,S)}else this.surface.trigger(d,yi.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.pg(r,e,!1,t)}tapFromPalette(r,e,t){this.pg(r,e,!0,t)}mousedownOnEdge(r){um(this,r,pe)}mouseupOnEdge(r){um(this,r,se)}mouseoverOnEdge(r){um(this,r,st)}mouseoutOnEdge(r){um(this,r,ot)}contextmenuOnEdge(r){um(this,r,bt)}clickOnOverlay(r,e){N$(this,r,e)}clickOnPort(r,e){I$(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Ut(r);this.eventManager.trigger(r,cs,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,cn,Ar(u.x+1,u.y+1)),this.eventManager.trigger(d,cn,Ar(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,zn,Ar(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Uy("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new qp(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<d$,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var YP="vjs-chart-background",La="vjs-chart-plot-background",Kh="vjs-chart-body",zP="vjs-chart-series",XP="vjs-chart-legend",gm="vjs-chart-legend-item",jP="vjs-chart-legend-label",HP="vjs-chart-legend-dot",wa="vjs-chart-axis",Em="vjs-chart-x-axis",fm="vjs-chart-y-axis",Hy="vjs-chart-axis-labels",ky="vjs-chart-axis-line",Wy="vjs-chart-axis-title",kP="vjs-chart-y-axis-title",WP="vjs-chart-x-axis-title",ZP="vjs-column-chart",JP="vjs-column-chart-column",KP="vjs-bar-chart",qP="vjs-bar-chart-bar",dn="vjs-chart-point",ym="vjs-chart-point-hit-area",QP="vjs-bubble-chart",e_="vjs-bubble-chart-point",t_="vjs-scatter-chart",r_="vjs-scatter-chart-point",xm="vjs-area-chart-area",n_="vjs-chart-title",i_="vjs-chart-subtitle",qh="vjs-chart-crosshair",Qh="vjs-chart-crosshair-label",o_="vjs-chart-crosshair-value-axis",s_="vjs-chart-crosshair-category-axis",Zy="vjs-chart-empty",a_="vjs-chart-axis-scale-label",Jy="vjs-chart-gridlines",Ky="vjs-chart-gridline",l_="vjs-line-chart",h_="vjs-area-chart";var G$=6;function qy(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function $$(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function B$(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function Qw(i,r,e,t,n,o){let s=qy(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=$$(s.step),u=qy(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=B$(s.step),u=qy(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function ec(i,r,e=G$,t,n){let o=r-i,s=eD(o);return Qw(i,r,s,e,t,n)}function c_(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function tc(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function eD(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function xi(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=G(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function ds(i,r,e,t){let n=k(Qe,r,e,t);return n.innerHTML=i,n}function F$(i,r){let e=rh(i);Yt(i,r,e.y)}function rc(i,r){let e=rh(i);Yt(i,e.x,r)}function Yt(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function un(i){return i.type==="value"}function d_(i){return i.type==="category"}function nc(){return{x:0,y:0,width:0,height:0}}function Qy(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function u_(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(tt(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function qw(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function bm(i,r,e,t,n,o){let s=G(Qe,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=G("tspan",{fill:qw(t),stroke:qw(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=G("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function ex(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Vt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),U$(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${qh}, .${Qh}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),m=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(m),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function U$(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var Y$="vertical",tx="horizontal",tD=10,rx="left",nx="center",p_="right",ic="top",oc="middle",ix="bottom",Am=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||tD,this.orientation=r.orientation||tx,this.align=r.align||nx,this.valign=r.valign||ix,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=xi(12,"normal","normal","sans-serif",r.font)}};var Sm="chart:load",m_="No data",g_="Could not draw chart";var rD="vjs-chart-exporter-hamburger",z$="vjs-chart-exporter-menu",X$="vjs-chart-exporter-menu-item",nD="vjs-chart-exporter-hamburger-open",Tm=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"Ao",!1);this.eventManager=new fe,this.eventManager.on(r.container,W,z(rD),t=>{t.stopPropagation(),this.Ao?this.uc():this.wb()})}Db(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=Wr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},rD),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=Wr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=Wr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},z$),[{label:"Download JPG",type:es},{label:"Download PNG",type:Lh},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Wr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},X$);a.innerText=s.label,this.eventManager.on(a,Ye,()=>{this.Nb(s.type),this.uc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this.Ao&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.Ao&&(n(),this.hideTimeout=setTimeout(()=>{this.uc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}wb(){this.menu.style.display="block",this.Ao=!0,L(this.hamburger,nD);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}uc(){this.menu.style.display="none",this.Ao=!1,F(this.hamburger,nD)}Nb(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:ba.svg});this.mg(n,`${e}.svg`)}else{let t=r===es?ba.jpeg:ba.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===es?"jpg":"png";this.mg(n.url,`${e}.${o}`,!0)})}}mg(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var j$="0 0 32 30",H$="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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",iD="0 0 32 32",k$="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",W$="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",Z$="vjs-chart-zoom-controls",J$="vjs-chart-zoom-button",ox=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new fe}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=Wr("div",{display:"flex",flexDirection:e},Z$),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:k$,viewBox:iD,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:W$,viewBox:iD,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:H$,viewBox:j$,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=Wr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},J$);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
|
|
135
135
|
<path d="${o.path}" ${o.title!=="Zoom to Extents"?'fill="none" stroke-width="2"':""}/>
|
|
136
|
-
</svg>`,this.eventManager.on(s,Fe,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var Uw="#FFFFFF",zw="#000000",L$=15,Yw=15,w$="middle",D$="left",N$="right",Xw="top",nc="bottom",La="middle",rO="start",nO="end",tO="#AAAAAA",jw=1,Hw="#FFFFFFCC";function I$(i){i=i||{};let r=i.backgroundColor||Uw;return{gridLineColor:i.gridLineColor||tO,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||tO,legendOutlineWidth:i.legendOutlineWidth||jw,legendBackgroundColor:i.legendBackgroundColor||Hw,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||zw,labelColorGenerator:i.labelColorGenerator}}var io=class extends Vt{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"W",1);c(this,"Kc",[.5,3]);c(this,"Zm",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"qc");c(this,"Qc");c(this,"Jm",!1);c(this,"Ks");c(this,"Xn");c(this,"yt");t=t||{},this.qc=t.width,this.Qc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new Ss:new zc(this.$defaultColor),this.style=I$(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=ir(n)?n:{};this.Ks=new fg(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||QP,this.$errorMessage=eO,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Jm&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||Yw,this.$eventManager=new fe,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||Xw):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||L$;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new mg(o),t.zoom&&t.zoom.enabled!==!1&&(this.Zm=!0,this.Kc=t.zoom.range||[.05,3],this.W=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.Xn=new Ky(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return Hy(this,e,t).svg}exportImage(e,t){let n=Hy(this,e.width,e.height);Jf(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.Xn&&this.Xn.destroy(),this.yt&&this.yt.parentElement&&this.yt.parentElement.removeChild(this.yt)}$draw(){this.Jm=!0,this.container.innerHTML="";let e=this.qc,t=this.Qc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=B(Pe,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},OP,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),JC(n,!0),this.db()}}db(){if(this.Ks||this.Xn){let e="row";this.yt==null?this.yt=kr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.yt.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.yt),this.Xn&&this.Xn.render(this.yt,e),this.Ks&&this.Ks.cb(this.yt)}}$drawEmptyMessage(e,t,n,o){let s=k(Qe,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Uy,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(Qe,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Uy,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(Qe,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},zP,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Iu(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(Ft(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(m=>m.getBBox().width),g=Math.max(...p);u.forEach((m,E)=>{m.setAttribute("x",`${(g-p[E])/2}`)})}if(this.$showSubtitle){let u=k(Qe,{y:s.height+10,x:0,"dominant-baseline":"hanging"},YP,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),g=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;Ft(u,g,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);Ft(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=ge(e);return this.$fromPageLocation(t)}getZoom(){return this.W}setZoom(e){return this.Zm&&(this.W=Math.max(this.Kc[0],Math.min(this.Kc[1],e)),this.ub()),this.W}ub(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.W})`))}};var wa=class{load(r){r()}hasData(){return!1}},ic=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},yg=class extends ic{constructor(e,t){super(e);this.chart=e;this.data=t}},xg=class extends ic{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){ta({url:this.url,dataType:Xt,success:t=>{this.data=t,super.load(e)}})}},oc=class extends ic{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=ea(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Me,o),t.bind(Re,o),t.bind(kt,o),t.bind(_e,o),t.bind(Ie,o),t.bind(jt,o),t.bind(ft,o),t.bind(yt,o),t.bind(sr,o),t.bind(Ht,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Ar=class{};var Kt=class extends Ar{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"Km");c(this,"K");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.Km=n,this.K=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.Km];t!=null&&ms(this.K,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(Kt,"type","record");var kw=1,Ww="rangeStart",Zw="values",Jw="minValues",Kw="maxValues",qw="label",Qw="id",Da=class extends Ar{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?kw:e.step,this.rangeStartField=e.rangeStartField||Ww,this.$valuesField=e.valuesField||Zw,this.$minValuesField=e.minValuesField||Jw,this.$maxValuesField=e.maxValuesField||Kw,this.$labelField=e.labelField||qw,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||Qw,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||G(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new Kt(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.qm(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.pb(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}pb(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.qm(e)}qm(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Da,"type","array");var Na=class extends Ar{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new Kt({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Na,"type","collation");var Ia=class extends Ar{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new Kt({valueField:"value",id:G(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(Ia,"type","summing");var sc=class extends Ar{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new Kt({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(sc,"type","summing-collation");var Ma=class extends io{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"Qm");this.dataSource=new wa,this.Qm=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.Qm.forEach(e=>{if(e.type==null||e.type===Kt.type){let t=new Kt(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Da.type){let t=new Da(e,this);this.$__series.push(t)}else if(e.type===Na.type){let t=new Na(e);this.$__series.push(t)}else if(e.type===sc.type){let t=new sc(e);this.$__series.push(t)}else if(e.type===Ia.type){let t=new Ia(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new yg(this,e.data):e.dataSource?this.dataSource=new oc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new xg(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof oc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(Eg,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var zn="data-vjs-chart-category",mt="data-vjs-chart-series",bg="data-vjs-chart-stack",Ag="data-vjs-chart-stack-total",Sg="data-vjs-chart-value",M$="data-vjs-filter",tr="start",mi="end",Ei=2,Tg=5,iO=10,qy=20,vg=14,oO=14,Cg="normal",sO="normal";var eD=["b","br","em","strong"],tD="vjs-tooltip",Ga=class extends Ho{constructor(e){super({formatter:(t,n)=>yc(t)?EA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Fr.type&&eD.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${eD.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==Gs.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=B("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=B("tspan");return n.style.fontStyle="italic",n;case"br":let o=B("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},Va=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"eh");c(this,"eg");var n,o,s,a;if(this.$parser=new Ga(e),this.$valueSuffix=e.valueSuffix,this.eh=e.timeout==null?2500:e.timeout,this.g=B(q,{"pointer-events":"none"},{},tD),Rt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=B("defs"),l.insertBefore(h,l.childNodes[0]));let d=B("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=B("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=B(Pe),this.root.appendChild(this.g);this.bg=B(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=B(Qe,t),this.g.appendChild(this.text),r.appendChild(this.root)}mb(){this.eh!==-1&&(clearTimeout(this.eg),this.eg=setTimeout(()=>this.hide(),this.eh))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=et(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};we(this.root,h),this.mb()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},$a=class extends Va{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},Pg=class extends Va{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var ac=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},Ba=class extends Ma{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"Qr");c(this,"$tooltip");c(this,"$maxLabelSize");this.Qr=t.tooltip,this.axisLineSize=t.axisLineSize||Ei,this.yAxisPadding=t.yAxisPadding||iO,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||Tg,this.dataSource=new wa,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(ot,Y(hn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(mt),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(it,Y(hn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(ot,Y(hg),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(mt),10);this.setFocusedSeries(s)}),this.$bind(it,Y(hg),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}gb(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},By,t)),e.titleElement=k(q,{},"",t),e.title!=null&&(Ft(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),hs(e.title,{"text-anchor":this.tg(e),"dominant-baseline":"hanging",y:this.legend.padding},[Fy,NP].join(" "),e.titleElement))}tg(e){return e.titleAlign===rO?"start":e.titleAlign===nO?"end":"middle"}Eb(e,t){e.titleElement=k(Qe,{y:0,x:0,"text-anchor":this.tg(e)},[Fy,DP].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(Q,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===tr)s.forEach(u=>u[0].setAttribute(Q,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(Q,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(Q,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(Ee,`${l}`);let h=e.position===tr?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(Q)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},By,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(q,{"data-z-index":100},RP,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((g,m)=>{let E=k(q,{[mt]:m},hg,s),y=k(Qe,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},LP,E);y.innerHTML=g.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:g.color,x:l,y:d},wP,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===ky?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(ve,`${u.width+2*p}`),a.setAttribute(De,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let g=this.legend.align===Zy?t/2-u.width/2:this.legend.align===Wy?this.margin:t-u.width-this.margin,m=this.legend.valign===Jy?n-u.height-this.margin:this.legend.valign===tc?o:(n-u.height)/2;Ft(s,g,m)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return cn(e)?this.fb(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.Qr&&(this.$tooltip=this.$createTooltip(e,this.Qr)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},_a,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${Ka()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(q,{"clip-path":`url(#${a})`},Wh,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(oe,p=>{let g=this.$fromEventLocation(p);this.$onMouseMove(g)}),u.addEventListener(bb,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,jP,p=>!cn(p)),this.seriesElements=this.$realisedSeries.map((p,g)=>k(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[mt]:`${g}`},_P,d)),this.$drawCrosshairs(d,!1,XP,p=>cn(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&cn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=hs("",g,Jh,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${Zh} ${n}`,e),p;if(l.showLabel!==!1&&cn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=hs("",g,Jh,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(q,{},null,e),s=k(q,{},null,e),a=k(q,{},null,e),l=k(q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:g,xAxesAtEnd:m}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===nc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?ec():b.getBBox(),T=(D,V)=>{let J=0;for(let ye=0;ye<D.length;ye++){let j=D[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style,fill:j.labelColor},[Ra,cg].join(" "),V),j.labelsElement=k(q,{},$y,j.element),j.labels=this.$getAxisLabels(j,!0),this.gb(j,j.element);let me=j.element.getBBox();j.dim=me,J+=me.height+this.yAxisPadding}};T(g,a),T(m,l);let S=this.$titlePlacement===nc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===tc?A.height:0):x+y.height+this.titlePadding,R=()=>{let D=a.getBBox(),V=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-V.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===rc?0:A.height)-this.margin,ye=(this.$titlePlacement===nc?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===tc?A.height:0);return{chartHeight:J,chartY:ye}},{chartHeight:v,chartY:O}=R(),P=(D,V)=>{let J=0;for(let ye=0;ye<D.length;ye++){let j=D[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style,fill:j.labelColor},[Ra,dg].join(" "),V),j.labelsElement=k(q,{},$y,j.element),j.labels=this.$getAxisLabels(j,!1),this.Eb(j,{y:O,height:v});let me=j.element.getBBox();Ft(j.element,J-me.x,0),j.dim=me,J+=me.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===rc&&this.legend.align===Wy?this.legend.padding+A.width:0);Ft(o,C,0);let _=C+I.width+this.yAxisPadding,w=t-_-(this.legend.visible&&!this.legend.floating&&this.legend.valign===rc&&this.legend.align===qP?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();Ft(s,_+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(ve,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let $=_+w,N=O+v,M={chartWidth:w,chartHeight:v,chartX:_,chartY:O,chartEndX:$,chartEndY:N,width:t,height:n};if(this.$titlePlacement===nc){let D=l.getBBox(),V=this.legend.visible&&!this.legend.floating&&this.legend.valign!==tc&&this.legend.valign!==rc?A.height+this.legend.padding:0;if(V>0){let ye=M.chartY+M.chartHeight+this.yAxisPadding+D.height+this.legend.padding;Qh(b,ye)}let J=M.chartY+M.chartHeight+this.yAxisPadding+D.height+V+this.titlePadding-this.margin;Ft(E,0,J)}for(let D=0;D<p.length;D++){let V=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;Ft(p[D].titleElement,V,p[D].title!=null?p[D].titlePadding:0),cn(p[D])?this.yb(M,p[D]):this.xb(M,p[D].labels);let J=this.$maxLabelSize*M.height;if(KP(p[D].labels,J,"height","width")){let j=p[D].labelsElement.getBBox();p[D].titleElement&&Qh(p[D].titleElement,j.y+j.height+this.yAxisPadding);let{chartHeight:me,chartY:Ge}=R();M.chartHeight=me,M.chartY=Ge,M.chartEndY=Ge+me}}Ft(a,M.chartX,S),Ft(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),Qh(o,M.chartY),Qh(s,M.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(De,`${M.chartHeight}`),cn(h[D])?this.Ab(M,h[D].labels,h[D]):this.Sb(M,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let V=p[D];V.showGrid&&this.Tb(e,M,V)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let V=h[D];V.showGrid&&this.vb(e,M,V)}}if(this.legend.visible&&this.legend.floating){let D=M.chartX+M.chartWidth-b.getBBox().width,V=M.chartY;Ft(b,D,V)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}xb(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Q,`${o*n+n/2}`)}yb(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(Q,`${n[o]}`)}Sb(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Ee,`${o*n+n/2}`)}fb(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=hs(h,l,HP,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}Ab(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(Ee,`${o[s]}`)}Tb(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},zy,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},Yy,s)}vb(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},zy,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},Yy,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(cn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(Q,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?jy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ga({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d+m.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-m.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+m.height/2:y=this.dim.chartY+this.dim.chartHeight-5-m.height/2,a.setAttribute(Q,`${E}`),a.setAttribute(Ee,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(ve,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(Q,`${this.dim.chartX+u*d}`)}s.setAttribute(Ee,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(cn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(Ee,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?jy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ga({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d-m.height-5>this.dim.chartY?d-5:d+m.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-m.width/2:y=this.dim.chartX+5+m.width/2,a.setAttribute(Q,`${y}`),a.setAttribute(Ee,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(De,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(Ee,`${this.dim.chartY+u*d}`)}s.setAttribute(Q,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(cn(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Og(i){return typeof i=="number"&&Number.isFinite(i)}function rD(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Og(e)||!Og(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function nD(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=rD(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function iD(i,r){if(r==null)return i;let e=dn({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Og(n.min),a=Og(n.max),l=Og(n.step);if(!s&&!a&&!l)continue;let h=o!=null?dn({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Ng(dn({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function oD(i){let r={};for(let[e,t]of Object.entries(i)){let n=rD(e,t);n!=null&&(t.step!=null?r[e]=qh(n.min,n.max,t.step):t.stepCount!=null?r[e]=ZP(n.min,n.max,t.stepCount):r[e]=Kh(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function aO(i){let r=nD(i.extentsList),e=iD(r,i.overrides),t=oD(e);return{extents:e,scales:t}}var Qy=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||xe}getDomainExtents(){return{}}},oo=class extends Qy{get $inverted(){return this.chart.$getXAxisType()!=="value"}},lO=new Map;function Fa(i,r){lO.set(i,r)}function hO(i,r,e){if(lO.has(i))return lO.get(i)(r,e)}function Ua(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var za=class extends Ar{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function V$(i){return{position:i,showLine:!1,showGrid:!0,id:xe}}function G$(i){return{position:i,id:xe}}var Yn=class extends Ba{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Eo");c(this,"fo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"rg");this.Eo=t.valueAxis,this.fo=t.categoryAxis,this.$inverted=t.inverted===!0,this.rg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=hO(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}Cb(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=hs(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return JP(e)?this.Cb(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}Ob(){var t,n,o;this.$categoryAxes=[];let e=this.fo==null?[G$(this.$inverted?mi:tr)]:Array.isArray(this.fo)?this.fo:[this.fo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:G(),h={showLine:a.showLine===!0,lineSize:a.lineSize||Ei,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||La,titlePadding:((o=a.title)==null?void 0:o.padding)||qy,position:a.position||(this.$inverted?mi:tr),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:gi(oO,sO,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}Pb(){if(this.$realisedSeries.length>0){let e=new Ss,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new Kt(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.K.has(u);t.forEach(m=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:m[0],min:E[m[2]],max:E[m[3]]}):d.addValue({id:m[0],value:E[m[1]]}))});let g=d;p&&(g.stack=u),a.push(g)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.rg)&&this.Pb(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.Ob(),this._b();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=aO({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}_b(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Eo==null?[V$(this.$inverted?tr:mi)]:Array.isArray(this.Eo)?this.Eo:[this.Eo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:G(),h=this.$plots.find(p=>p.$valueAxis===l&&Ua(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||Ei,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||Ei,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||La,titlePadding:((o=a.title)==null?void 0:o.padding)||qy,position:a.position||(this.$inverted?tr:mi),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:gi(vg,Cg,"normal","sans-serif",a.font),scale:new ac,stackedScale:new ac,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===tr),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===mi)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===tr),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===mi)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===tr),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===mi)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===tr),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===mi)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}Rb(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.Rb(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(zn),10),a=e.getAttribute(bg),l=e.getAttribute(Ag),h=e.getAttribute(Sg);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],g=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:g,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new $a(e,t)}};var $$=fr(),sD={square:(i,r,e)=>B(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>B(Xe,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>B(te,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function _g(i,r,e,t,n,o){let s=i.markerType||"circle",l=(sD[s]||sD.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function lc(i,r,e,t){let o=$$.template(G(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var Ya=class extends Ba{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"$");c(this,"F");c(this,"ng");c(this,"ig");this.axisFont=gi(vg,Cg,"normal","sans-serif",t.axisFont),this.$=t.xAxis||{},this.F=t.yAxis||{},this.ng=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.ig=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(ot,Y(ug),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(mt)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},g={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(g,{x:.5,y:1.1},a,h)}}),this.$bind(it,Y(ug),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Pg(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new za(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.$.min!==void 0?this.$.min:1/0,max:this.$.max!==void 0?this.$.max:-1/0},this.$yAxisDimensions={min:this.F.min!==void 0?this.F.min:1/0,max:this.F.max!==void 0?this.F.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.qc||500,o=this.Qc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,g=p/n*e,m=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-g),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+g),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-m),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+m)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.F.inverted===!0,labelColor:this.F.labelColor||this.style.labelColor,labelColorGenerator:this.F.labelColorGenerator||this.style.labelColorGenerator,min:this.F.min,max:this.F.max,showLine:this.F.showLine===!0,lineSize:this.F.lineSize||Ei,dim:ec(),element:k(q,{},[Ra,dg].join(" "),e),id:this.F.id||G(),position:this.F.position||tr,titleAlign:((t=this.F.title)==null?void 0:t.align)||La,title:(n=this.F.title)==null?void 0:n.text,titlePadding:((o=this.F.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.F.showGrid!==!1,gridLineSize:this.F.lineSize||2,useSeriesTotal:!1,font:((s=this.F)==null?void 0:s.font)||this.axisFont,scale:this.F.step!=null?qh(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.F.step):Kh(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.F.crosshair,step:this.F.step,labelPrefix:this.F.labelPrefix,labelSuffix:this.F.labelSuffix,labelFormatter:this.F.labelFormatter},this.xAxis={domain:"x",inverted:this.$.inverted===!0,labelColor:this.$.labelColor||this.style.labelColor,labelColorGenerator:this.$.labelColorGenerator||this.style.labelColorGenerator,min:this.$.min,max:this.$.max,showLine:this.$.showLine===!0,lineSize:this.$.lineSize||Ei,dim:ec(),element:k(q,{},[Ra,cg].join(" "),e),id:this.$.id||G(),position:this.$.position||tr,titleAlign:((a=this.$.title)==null?void 0:a.align)||La,title:((l=this.$.title)==null?void 0:l.text)||"",titlePadding:((h=this.$.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.$.showGrid!==!1,gridLineSize:this.$.lineSize||2,useSeriesTotal:!1,font:((d=this.$)==null?void 0:d.font)||this.axisFont,scale:this.$.step!=null?qh(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.$.step):Kh(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.$.crosshair,step:this.$.step,labelPrefix:this.$.labelPrefix,labelSuffix:this.$.labelSuffix,labelFormatter:this.$.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,g=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(g=1-g);let m=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=g*this.dim.chartHeight,x;if(n.marker)x=lc(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:m});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=lc(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:m,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=_g(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:m});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Yc(m).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(mt,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(hn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(B(Xe,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[mt]:o.toString(),"data-idx":l.toString()},null,ug))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.ig,Math.max(this.ng,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var aD=.8,lD=50,hD=10;function B$(i){return i.type===Lr.type}var ex=class ex extends oo{constructor(e,t){super(e,t,ex.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),Ua(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let g=p.stack||"default",m=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof m=="number"&&Number.isFinite(m)&&(u[g]+=m)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=Ua(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?hD:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?aD:this.options.fillRatio)*s,d=this.options.maxBarSize==null?lD:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return Ua(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],g=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),g+=y});let m=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+m)/g,f=m/g,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}else{let x=(E[1]+m)/g,f=m/g,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}m+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],g=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),g+=x});let m=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+m)/E.range,b=m/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}else{let f=(y[1]+m)/E.range,b=m/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}m+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let g=s[p],m=n==null?g.values[h].min:Math.max(n,g.values[h].min),E=o==null?g.values[h].max:Math.min(g.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:g.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:g.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[MP,hn].join(" "):[GP,hn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[zn]:`${d.category}`,[mt]:`${d.series}`};d.stackId!=null&&(u[bg]=d.stackId),d.stackTotal!=null&&(u[Ag]=`${d.stackTotal}`),d.value!=null&&(u[Sg]=`${d.value}`),F$(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;gg(a,l,h,n.color,{size:11},t)}}};c(ex,"type","bar");var Lr=ex;Fa(Lr.type,(i,r)=>new Lr(i,r));function F$(i,r,e,t,n,o,s,a){let l,h=a||Tg;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(te,Object.assign({d:l},e),t,n)}var cO=class extends Yn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:hc.type,options:e.plotOptions||{}}})),L(r,WP),this.$bind(oe,Y(Wh),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(oe,Y(pg),t=>{let n=t.target,o=parseInt(n.getAttribute(mt),10);this.setFocusedSeries(o)}),this.$bind(it,Y(pg,Wh),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},tx=class tx extends oo{constructor(e,t){var n,o;super(e,t,tx.type);this.chart=e;c(this,"stacked");c(this,"th");c(this,"og");c(this,"nh");c(this,"xt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.th=((n=t.marker)==null?void 0:n.enabled)!==!1,this.og=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.xt.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.xt[h]=this.xt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.xt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.xt[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.xt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.xt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.xt.length;l++){let h=s[l].color,d=`M ${this.xt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(te,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[mt]:`${l}`},pg,this.chart.seriesElements[l])}this.nh=k(Xe,{cx:"0",cy:"0",r:this.og/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.th!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.xt[s][e];return ce(this.nh,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Yc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.th!==!1&&ce(this.nh,{visibility:"hidden"})}};c(tx,"type","area");var hc=tx;Fa(hc.type,(i,r)=>new hc(i,r));var dO=class extends Yn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,IP)}};var uO=class extends Yn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,VP)}};var rx=class extends za{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},pO=class extends Ya{constructor(e,t){super(e,t);this.options=t;L(e,$P)}$dualValueInit(e){e.series.forEach(t=>{let n=new rx(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,g=n+Math.sqrt(p)*(d-n);return Math.max(n,g)}$getDataPointCssClass(){return BP}};var cD="vjs-gauge-chart",dD="vjs-gauge-track",gO="vjs-gauge-zone",uD="vjs-gauge-tick",pD="vjs-gauge-label",gD="vjs-gauge-needle",mD="vjs-gauge-needle-pivot",mO=class extends io{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"bt");c(this,"yo");c(this,"_e");c(this,"be");c(this,"_t");c(this,"ih");this.bt=(n=t.startAngle)!=null?n:-135,this.yo=(o=t.endAngle)!=null?o:135,this._e=(s=t.innerRadius)!=null?s:.8,this.be=(a=t.min)!=null?a:0,this._t=(l=t.max)!=null?l:100,this.ih=(h=t.value)!=null?h:this.be,L(e,cD),this.$draw()}getValue(){return this.ih}setValue(e){this.ih=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var ye;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},_a,e);e.insertBefore(s,o.nextElementSibling);let a=j=>(j-90)*Math.PI/180,l=a(this.bt),h=a(this.yo),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),g=Math.sin(l),m=[h];for(let j=-180;j<=270;j+=90){let me=a(j);j>=this.bt&&j<=this.yo&&m.push(me)}m.forEach(j=>{d=Math.min(d,Math.cos(j)),u=Math.max(u,Math.cos(j)),p=Math.min(p,Math.sin(j)),g=Math.max(g,Math.sin(j))});let E=.9,y=u-d,x=g-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(g+p)/2,T=f*this._e,S=b+f*Math.cos(l),R=A+f*Math.sin(l),v=b+f*Math.cos(h),O=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),_=A+T*Math.sin(l),w=this.yo-this.bt<=180?0:1,$=[`M ${S} ${R}`,`A ${f} ${f} 0 ${w} 1 ${v} ${O}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${_}`,"Z"].join(" ");k(te,{d:$,fill:"#EEE",stroke:"#CCC","stroke-width":1},dD,e);let N=(ye=this.getValue())!=null?ye:this.be,M=Math.max(this.be,Math.min(this._t,N)),D=this._t-this.be,V=this.yo-this.bt,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((j,me)=>{let Ge=j.from,je=j.to;if(!J){if(M<=Ge)return;je=Math.min(je,M)}let Ut=this.bt+(Ge-this.be)/D*V,rr=this.bt+(je-this.be)/D*V,qt=a(Ut),wr=a(rr),ao=b+f*Math.cos(qt),Xa=A+f*Math.sin(qt),ja=b+f*Math.cos(wr),Ha=A+f*Math.sin(wr),ka=b+T*Math.cos(wr),Wa=A+T*Math.sin(wr),Lg=b+T*Math.cos(qt),wg=A+T*Math.sin(qt),dc=rr-Ut<=180?0:1,Dg=[`M ${ao} ${Xa}`,`A ${f} ${f} 0 ${dc} 1 ${ja} ${Ha}`,`L ${ka} ${Wa}`,`A ${T} ${T} 0 ${dc} 0 ${Lg} ${wg}`,"Z"].join(" "),uc=j.color;if(j.gradient){let ds=e.querySelector("defs");ds||(ds=k("defs",{},"",e),e.insertBefore(ds,e.firstChild));let ne=`vjs-gauge-gradient-${me}-${Math.round(Math.random()*1e6)}`,Ue=k("linearGradient",{id:ne,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",ds);j.gradient.stops.forEach(Lt=>{k("stop",{offset:`${Lt.offset}%`,"stop-color":Lt.color},"",Ue)}),uc=`url(#${ne})`}k(te,{d:Dg,fill:uc,stroke:"none"},`${gO} ${gO}-${me}`,e)}),this.options.ticks){let j=[];if(this.options.ticks.values)j=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let me=this.be;me<=this._t;me+=this.options.ticks.interval)j.push(me);j.forEach(me=>{let Ge=this.bt+(me-this.be)/D*V,je=a(Ge),Ut=f*.95,rr=b+f*Math.cos(je),qt=A+f*Math.sin(je),wr=b+Ut*Math.cos(je),ao=A+Ut*Math.sin(je);k(te,{d:`M ${rr} ${qt} L ${wr} ${ao}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},uD,e)})}if(this.options.labels){let j=[];if(this.options.labels.values)j=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Ge=this.be;Ge<=this._t;Ge+=this.options.labels.interval)j.push(Ge);let me=f+(this.options.labels.distance||0);j.forEach(Ge=>{let je=this.bt+(Ge-this.be)/D*V,Ut=a(je),rr=b+me*Math.cos(Ut),qt=A+me*Math.sin(Ut);k("text",{x:rr,y:qt,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},pD,e).textContent=Ge.toString()})}if(J){let j=this.bt+(M-this.be)/D*V,me=a(j),Ge=f*.9,je=f*.05,Ut=me-Math.PI/2,rr=me+Math.PI/2,qt=b+Ge*Math.cos(me),wr=A+Ge*Math.sin(me),ao=b+je*Math.cos(Ut),Xa=A+je*Math.sin(Ut),ja=b+je*Math.cos(rr),Ha=A+je*Math.sin(rr),ka=`M ${ao} ${Xa} L ${qt} ${wr} L ${ja} ${Ha} Z`;k(te,{d:ka,fill:"#333",stroke:"#000","stroke-width":1},gD,e);let Wa=je*1.5;k("circle",{cx:b,cy:A,r:Wa,fill:"#333",stroke:"#666","stroke-width":1},mD,e)}}};var EO=class extends Yn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:cc.type,options:t.plotOptions||{}}}));this.options=t;L(e,kP)}},nx=class nx extends oo{constructor(e,t){super(e,t,nx.type);this.chart=e;c(this,"sg");c(this,"ag");this.sg=t.stacked===!0,this.ag=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.sg&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}Lb(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=mE(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}wb(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let g,m;return this.$inverted?(m=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,g=u):(g=t.chartWidth*((p-a.minScale)/a.range),m=u),{cx:g,cy:m}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let g=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let m=s[p],E=m.values[u].max,{cx:y,cy:x}=d(g,E);if(E!=null&&this.lg(s[p],y,x,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),m.isRangeSeries()){let{cx:f,cy:b}=d(g,m.values[u].min);m.values[u].min!=null&&this.lg(s[p],f,b,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:m.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,g=l[u].findIndex(E=>E.hasValue),m=this.ag?this.Lb(l[u],g):this.wb(l[u],g);k(te,{stroke:p,"stroke-width":"1",d:m,fill:"none",[mt]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let g=h[u].findIndex(E=>E.hasValue),m=`M ${h[u].slice(g).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(te,{stroke:p,"stroke-width":"1",d:m,fill:"none",[mt]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}lg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=lc(e.marker,null,{[zn]:`${l}`,[mt]:`${h}`},[hn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=_g(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[zn]:`${l}`,[mt]:`${h}`},[hn].join(" "));return d.appendChild(u),u}}};c(nx,"type","line");var cc=nx;Fa(cc.type,(i,r)=>new cc(i,r));var ED="vjs-pie-chart",Rg="vjs-pie-slice",fO="vjs-pie-slice-selected",yO=class extends Ma{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"xo");c(this,"bo");c(this,"oh");c(this,"jn");c(this,"_e");c(this,"$realisedSeries",[]);c(this,"Qr");this.xo=t.selectedCategory,this.oh=t.selectedSliceOffset||10,this.jn=t.interactive===!0,this._e=t.innerRadius,this.Qr=t.tooltip,this.$init(),this.load(t),this.$bind(ot,Y(Rg),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.cg(o),p=this.$dataPoints[d],g=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},g,p.label,{value:p.value})}}),this.$bind(it,Y(Rg),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,Y(Rg),n=>{if(this.jn){let o=n.target,{category:s,series:a}=this.cg(o);this.Db(s,a,o)}}),L(e,ED)}cg(e){let t=parseInt(e.getAttribute(zn),10),n=parseInt(e.parentNode.getAttribute(mt),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.Qr&&(this.$tooltip=new $a(e,this.Qr)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},_a,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,g)=>{let m=B(q,{"data-name":p.label,"data-category":g});e.appendChild(m);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,R="";if(p.p>=1)if(this._e!=null){let V=this._e*h;R=`M ${a.x+h} ${a.y}
|
|
136
|
+
</svg>`,this.eventManager.on(s,Ye,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var oD="#FFFFFF",sD="#000000",K$=15,aD=15,q$="middle",Q$="left",eB="right",lD="top",sc="bottom",Da="middle",f_="start",y_="end",E_="#AAAAAA",hD=1,cD="#FFFFFFCC";function tB(i){i=i||{};let r=i.backgroundColor||oD;return{gridLineColor:i.gridLineColor||E_,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||E_,legendOutlineWidth:i.legendOutlineWidth||hD,legendBackgroundColor:i.legendBackgroundColor||cD,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||sD,labelColorGenerator:i.labelColorGenerator}}var so=class extends Gt{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"J",1);c(this,"pc",[.5,3]);c(this,"gg",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"mc");c(this,"gc");c(this,"Eg",!1);c(this,"sa");c(this,"qn");c(this,"St");t=t||{},this.mc=t.width,this.gc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new vs:new Xc(this.$defaultColor),this.style=tB(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=ar(n)?n:{};this.sa=new Tm(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||m_,this.$errorMessage=g_,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Eg&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||aD,this.$eventManager=new fe,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||lD):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||K$;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new Am(o),t.zoom&&t.zoom.enabled!==!1&&(this.gg=!0,this.pc=t.zoom.range||[.05,3],this.J=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.qn=new ox(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return ex(this,e,t).svg}exportImage(e,t){let n=ex(this,e.width,e.height);ry(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.qn&&this.qn.destroy(),this.St&&this.St.parentElement&&this.St.parentElement.removeChild(this.St)}$draw(){this.Eg=!0,this.container.innerHTML="";let e=this.mc,t=this.gc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=G(Pe,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},YP,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),uP(n,!0),this.Ib()}}Ib(){if(this.sa||this.qn){let e="row";this.St==null?this.St=Wr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.St.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.St),this.qn&&this.qn.render(this.St,e),this.sa&&this.sa.Db(this.St)}}$drawEmptyMessage(e,t,n,o){let s=k(Qe,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Zy,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(Qe,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},Zy,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(Qe,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},n_,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Bu(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(Yt(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(g=>g.getBBox().width),m=Math.max(...p);u.forEach((g,E)=>{g.setAttribute("x",`${(m-p[E])/2}`)})}if(this.$showSubtitle){let u=k(Qe,{y:s.height+10,x:0,"dominant-baseline":"hanging"},i_,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),m=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;Yt(u,m,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);Yt(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=me(e);return this.$fromPageLocation(t)}getZoom(){return this.J}setZoom(e){return this.gg&&(this.J=Math.max(this.pc[0],Math.min(this.pc[1],e)),this.Mb()),this.J}Mb(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.J})`))}};var Na=class{load(r){r()}hasData(){return!1}},ac=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},vm=class extends ac{constructor(e,t){super(e);this.chart=e;this.data=t}},Cm=class extends ac{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){na({url:this.url,dataType:Ht,success:t=>{this.data=t,super.load(e)}})}},lc=class extends ac{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=ra(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Ve,o),t.bind(Re,o),t.bind(Zt,o),t.bind(Oe,o),t.bind(Me,o),t.bind(kt,o),t.bind(yt,o),t.bind(xt,o),t.bind(hr,o),t.bind(Wt,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Sr=class{};var er=class extends Sr{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"fg");c(this,"Q");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.fg=n,this.Q=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.fg];t!=null&&fs(this.Q,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(er,"type","record");var dD=1,uD="rangeStart",pD="values",mD="minValues",gD="maxValues",ED="label",fD="id",Ia=class extends Sr{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?dD:e.step,this.rangeStartField=e.rangeStartField||uD,this.$valuesField=e.valuesField||pD,this.$minValuesField=e.minValuesField||mD,this.$maxValuesField=e.maxValuesField||gD,this.$labelField=e.labelField||ED,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||fD,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||$(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new er(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.yg(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.Vb(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}Vb(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.yg(e)}yg(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Ia,"type","array");var Ma=class extends Sr{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new er({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ma,"type","collation");var Va=class extends Sr{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new er({valueField:"value",id:$(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(Va,"type","summing");var hc=class extends Sr{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new er({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(hc,"type","summing-collation");var Ga=class extends so{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"xg");this.dataSource=new Na,this.xg=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.xg.forEach(e=>{if(e.type==null||e.type===er.type){let t=new er(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Ia.type){let t=new Ia(e,this);this.$__series.push(t)}else if(e.type===Ma.type){let t=new Ma(e);this.$__series.push(t)}else if(e.type===hc.type){let t=new hc(e);this.$__series.push(t)}else if(e.type===Va.type){let t=new Va(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new vm(this,e.data):e.dataSource?this.dataSource=new lc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new Cm(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof lc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(Sm,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var Xn="data-vjs-chart-category",Et="data-vjs-chart-series",Pm="data-vjs-chart-stack",_m="data-vjs-chart-stack-total",Om="data-vjs-chart-value",rB="data-vjs-filter",ir="start",bi="end",Ai=2,Rm=5,x_=10,sx=20,Lm=14,b_=14,wm="normal",A_="normal";var yD=["b","br","em","strong"],xD="vjs-tooltip",Ba=class extends Wo{constructor(e){super({formatter:(t,n)=>bc(t)?wA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Fr.type&&yD.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${yD.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==Bs.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=G("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=G("tspan");return n.style.fontStyle="italic",n;case"br":let o=G("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},$a=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"Ec");c(this,"Ag");var n,o,s,a;if(this.$parser=new Ba(e),this.$valueSuffix=e.valueSuffix,this.Ec=e.timeout==null?2500:e.timeout,this.g=G(q,{"pointer-events":"none"},{},xD),Rt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=G("defs"),l.insertBefore(h,l.childNodes[0]));let d=G("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=G("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=G(Pe),this.root.appendChild(this.g);this.bg=G(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=G(Qe,t),this.g.appendChild(this.text),r.appendChild(this.root)}Gb(){this.Ec!==-1&&(clearTimeout(this.Ag),this.Ag=setTimeout(()=>this.hide(),this.Ec))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=et(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};we(this.root,h),this.Gb()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},Fa=class extends $a{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},Dm=class extends $a{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var cc=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},Ua=class extends Ga{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"ln");c(this,"$tooltip");c(this,"$maxLabelSize");this.ln=t.tooltip,this.axisLineSize=t.axisLineSize||Ai,this.yAxisPadding=t.yAxisPadding||x_,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||Rm,this.dataSource=new Na,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(st,z(dn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(ot,z(dn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(st,z(gm),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s)}),this.$bind(ot,z(gm),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}$b(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},ky,t)),e.titleElement=k(q,{},"",t),e.title!=null&&(Yt(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),ds(e.title,{"text-anchor":this.Sg(e),"dominant-baseline":"hanging",y:this.legend.padding},[Wy,WP].join(" "),e.titleElement))}Sg(e){return e.titleAlign===f_?"start":e.titleAlign===y_?"end":"middle"}Bb(e,t){e.titleElement=k(Qe,{y:0,x:0,"text-anchor":this.Sg(e)},[Wy,kP].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(Q,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===ir)s.forEach(u=>u[0].setAttribute(Q,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(Q,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(Q,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(Ee,`${l}`);let h=e.position===ir?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(Q)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},ky,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(q,{"data-z-index":100},XP,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((m,g)=>{let E=k(q,{[Et]:g},gm,s),y=k(Qe,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},jP,E);y.innerHTML=m.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:m.color,x:l,y:d},HP,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===tx?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(ve,`${u.width+2*p}`),a.setAttribute(Ne,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let m=this.legend.align===nx?t/2-u.width/2:this.legend.align===rx?this.margin:t-u.width-this.margin,g=this.legend.valign===ix?n-u.height-this.margin:this.legend.valign===ic?o:(n-u.height)/2;Yt(s,m,g)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return un(e)?this.Fb(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.ln&&(this.$tooltip=this.$createTooltip(e,this.ln)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${Qa()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(q,{"clip-path":`url(#${a})`},Kh,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(oe,p=>{let m=this.$fromEventLocation(p);this.$onMouseMove(m)}),u.addEventListener(Vb,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,s_,p=>!un(p)),this.seriesElements=this.$realisedSeries.map((p,m)=>k(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[Et]:`${m}`},zP,d)),this.$drawCrosshairs(d,!1,o_,p=>un(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${qh} ${n}`,e),p;if(l.showLabel!==!1&&un(s)){let m={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(m["font-style"]=l.labelFont.style),p=ds("",m,Qh,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${qh} ${n}`,e),p;if(l.showLabel!==!1&&un(s)){let m={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(m["font-style"]=l.labelFont.style),p=ds("",m,Qh,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(q,{},null,e),s=k(q,{},null,e),a=k(q,{},null,e),l=k(q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:m,xAxesAtEnd:g}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===sc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?nc():b.getBBox(),T=(D,V)=>{let J=0;for(let ye=0;ye<D.length;ye++){let j=D[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style,fill:j.labelColor},[wa,Em].join(" "),V),j.labelsElement=k(q,{},Hy,j.element),j.labels=this.$getAxisLabels(j,!0),this.$b(j,j.element);let ge=j.element.getBBox();j.dim=ge,J+=ge.height+this.yAxisPadding}};T(m,a),T(g,l);let S=this.$titlePlacement===sc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===ic?A.height:0):x+y.height+this.titlePadding,R=()=>{let D=a.getBBox(),V=l.getBBox(),J=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-V.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===oc?0:A.height)-this.margin,ye=(this.$titlePlacement===sc?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===ic?A.height:0);return{chartHeight:J,chartY:ye}},{chartHeight:v,chartY:_}=R(),P=(D,V)=>{let J=0;for(let ye=0;ye<D.length;ye++){let j=D[ye];j.element=k(q,{"font-size":j.font.size,"font-face":j.font.style,fill:j.labelColor},[wa,fm].join(" "),V),j.labelsElement=k(q,{},Hy,j.element),j.labels=this.$getAxisLabels(j,!1),this.Bb(j,{y:_,height:v});let ge=j.element.getBBox();Yt(j.element,J-ge.x,0),j.dim=ge,J+=ge.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===oc&&this.legend.align===rx?this.legend.padding+A.width:0);Yt(o,C,0);let O=C+I.width+this.yAxisPadding,w=t-O-(this.legend.visible&&!this.legend.floating&&this.legend.valign===oc&&this.legend.align===p_?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();Yt(s,O+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(ve,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=O+w,N=_+v,M={chartWidth:w,chartHeight:v,chartX:O,chartY:_,chartEndX:B,chartEndY:N,width:t,height:n};if(this.$titlePlacement===sc){let D=l.getBBox(),V=this.legend.visible&&!this.legend.floating&&this.legend.valign!==ic&&this.legend.valign!==oc?A.height+this.legend.padding:0;if(V>0){let ye=M.chartY+M.chartHeight+this.yAxisPadding+D.height+this.legend.padding;rc(b,ye)}let J=M.chartY+M.chartHeight+this.yAxisPadding+D.height+V+this.titlePadding-this.margin;Yt(E,0,J)}for(let D=0;D<p.length;D++){let V=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;Yt(p[D].titleElement,V,p[D].title!=null?p[D].titlePadding:0),un(p[D])?this.Ub(M,p[D]):this.zb(M,p[D].labels);let J=this.$maxLabelSize*M.height;if(u_(p[D].labels,J,"height","width")){let j=p[D].labelsElement.getBBox();p[D].titleElement&&rc(p[D].titleElement,j.y+j.height+this.yAxisPadding);let{chartHeight:ge,chartY:Be}=R();M.chartHeight=ge,M.chartY=Be,M.chartEndY=Be+ge}}Yt(a,M.chartX,S),Yt(l,M.chartX,M.chartY+M.chartHeight+this.yAxisPadding),rc(o,M.chartY),rc(s,M.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(Ne,`${M.chartHeight}`),un(h[D])?this.Yb(M,h[D].labels,h[D]):this.Xb(M,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let V=p[D];V.showGrid&&this.jb(e,M,V)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let V=h[D];V.showGrid&&this.Hb(e,M,V)}}if(this.legend.visible&&this.legend.floating){let D=M.chartX+M.chartWidth-b.getBBox().width,V=M.chartY;Yt(b,D,V)}return M}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}zb(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Q,`${o*n+n/2}`)}Ub(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(Q,`${n[o]}`)}Xb(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(Ee,`${o*n+n/2}`)}Fb(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=ds(h,l,a_,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}Yb(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(Ee,`${o[s]}`)}jb(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},Jy,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},Ky,s)}Hb(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(q,{transform:`translate(${t.chartX}, ${t.chartY})`},Jy,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},Ky,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(un(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(Q,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Qy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d+g.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-g.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+g.height/2:y=this.dim.chartY+this.dim.chartHeight-5-g.height/2,a.setAttribute(Q,`${E}`),a.setAttribute(Ee,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(ve,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(Q,`${this.dim.chartX+u*d}`)}s.setAttribute(Ee,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(un(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(Ee,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),m=l.labelValueFormat!==void 0?Qy(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ba({format:l.labelFormat}).renderTooltip({value:m,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=m;let g=a.getBBox(),E=d-g.height-5>this.dim.chartY?d-5:d+g.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-g.width/2:y=this.dim.chartX+5+g.width/2,a.setAttribute(Q,`${y}`),a.setAttribute(Ee,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(Ne,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(Ee,`${this.dim.chartY+u*d}`)}s.setAttribute(Q,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(un(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Nm(i){return typeof i=="number"&&Number.isFinite(i)}function bD(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Nm(e)||!Nm(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function AD(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=bD(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function SD(i,r){if(r==null)return i;let e=pn({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Nm(n.min),a=Nm(n.max),l=Nm(n.step);if(!s&&!a&&!l)continue;let h=o!=null?pn({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Bm(pn({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function TD(i){let r={};for(let[e,t]of Object.entries(i)){let n=bD(e,t);n!=null&&(t.step!=null?r[e]=tc(n.min,n.max,t.step):t.stepCount!=null?r[e]=c_(n.min,n.max,t.stepCount):r[e]=ec(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function S_(i){let r=AD(i.extentsList),e=SD(r,i.overrides),t=TD(e);return{extents:e,scales:t}}var ax=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||xe}getDomainExtents(){return{}}},ao=class extends ax{get $inverted(){return this.chart.$getXAxisType()!=="value"}},T_=new Map;function Ya(i,r){T_.set(i,r)}function v_(i,r,e){if(T_.has(i))return T_.get(i)(r,e)}function za(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var Xa=class extends Sr{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function nB(i){return{position:i,showLine:!1,showGrid:!0,id:xe}}function iB(i){return{position:i,id:xe}}var jn=class extends Ua{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"So");c(this,"To");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"Tg");this.So=t.valueAxis,this.To=t.categoryAxis,this.$inverted=t.inverted===!0,this.Tg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=v_(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}kb(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=ds(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return d_(e)?this.kb(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}Wb(){var t,n,o;this.$categoryAxes=[];let e=this.To==null?[iB(this.$inverted?bi:ir)]:Array.isArray(this.To)?this.To:[this.To];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:$(),h={showLine:a.showLine===!0,lineSize:a.lineSize||Ai,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||sx,position:a.position||(this.$inverted?bi:ir),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:xi(b_,A_,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}Zb(){if(this.$realisedSeries.length>0){let e=new vs,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new er(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.Q.has(u);t.forEach(g=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:g[0],min:E[g[2]],max:E[g[3]]}):d.addValue({id:g[0],value:E[g[1]]}))});let m=d;p&&(m.stack=u),a.push(m)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.Tg)&&this.Zb(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.Wb(),this.Jb();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=S_({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}Jb(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.So==null?[nB(this.$inverted?ir:bi)]:Array.isArray(this.So)?this.So:[this.So];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?xe:$(),h=this.$plots.find(p=>p.$valueAxis===l&&za(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||Ai,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||Ai,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Da,titlePadding:((o=a.title)==null?void 0:o.padding)||sx,position:a.position||(this.$inverted?ir:bi),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:xi(Lm,wm,"normal","sans-serif",a.font),scale:new cc,stackedScale:new cc,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===ir),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===bi)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===ir),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===bi)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===ir),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===bi)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===ir),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===bi)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}Kb(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.Kb(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(Xn),10),a=e.getAttribute(Pm),l=e.getAttribute(_m),h=e.getAttribute(Om);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],m=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:m,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new Fa(e,t)}};var oB=yr(),vD={square:(i,r,e)=>G(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>G(He,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>G(ee,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function Im(i,r,e,t,n,o){let s=i.markerType||"circle",l=(vD[s]||vD.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function dc(i,r,e,t){let o=oB.template($(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var ja=class extends Ua{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"U");c(this,"j");c(this,"vg");c(this,"Cg");this.axisFont=xi(Lm,wm,"normal","sans-serif",t.axisFont),this.U=t.xAxis||{},this.j=t.yAxis||{},this.vg=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.Cg=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(st,z(ym),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(Et)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},m={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(m,{x:.5,y:1.1},a,h)}}),this.$bind(ot,z(ym),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Dm(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new Xa(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.U.min!==void 0?this.U.min:1/0,max:this.U.max!==void 0?this.U.max:-1/0},this.$yAxisDimensions={min:this.j.min!==void 0?this.j.min:1/0,max:this.j.max!==void 0?this.j.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.mc||500,o=this.gc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,m=p/n*e,g=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-m),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+m),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-g),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+g)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.j.inverted===!0,labelColor:this.j.labelColor||this.style.labelColor,labelColorGenerator:this.j.labelColorGenerator||this.style.labelColorGenerator,min:this.j.min,max:this.j.max,showLine:this.j.showLine===!0,lineSize:this.j.lineSize||Ai,dim:nc(),element:k(q,{},[wa,fm].join(" "),e),id:this.j.id||$(),position:this.j.position||ir,titleAlign:((t=this.j.title)==null?void 0:t.align)||Da,title:(n=this.j.title)==null?void 0:n.text,titlePadding:((o=this.j.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.j.showGrid!==!1,gridLineSize:this.j.lineSize||2,useSeriesTotal:!1,font:((s=this.j)==null?void 0:s.font)||this.axisFont,scale:this.j.step!=null?tc(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.j.step):ec(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.j.crosshair,step:this.j.step,labelPrefix:this.j.labelPrefix,labelSuffix:this.j.labelSuffix,labelFormatter:this.j.labelFormatter},this.xAxis={domain:"x",inverted:this.U.inverted===!0,labelColor:this.U.labelColor||this.style.labelColor,labelColorGenerator:this.U.labelColorGenerator||this.style.labelColorGenerator,min:this.U.min,max:this.U.max,showLine:this.U.showLine===!0,lineSize:this.U.lineSize||Ai,dim:nc(),element:k(q,{},[wa,Em].join(" "),e),id:this.U.id||$(),position:this.U.position||ir,titleAlign:((a=this.U.title)==null?void 0:a.align)||Da,title:((l=this.U.title)==null?void 0:l.text)||"",titlePadding:((h=this.U.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.U.showGrid!==!1,gridLineSize:this.U.lineSize||2,useSeriesTotal:!1,font:((d=this.U)==null?void 0:d.font)||this.axisFont,scale:this.U.step!=null?tc(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.U.step):ec(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.U.crosshair,step:this.U.step,labelPrefix:this.U.labelPrefix,labelSuffix:this.U.labelSuffix,labelFormatter:this.U.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,m=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(m=1-m);let g=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=m*this.dim.chartHeight,x;if(n.marker)x=dc(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:g});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=dc(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:g,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=Im(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:g});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||jc(g).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(Et,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(dn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(G(He,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[Et]:o.toString(),"data-idx":l.toString()},null,ym))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.Cg,Math.max(this.vg,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var CD=.8,PD=50,_D=10;function sB(i){return i.type===Lr.type}var lx=class lx extends ao{constructor(e,t){super(e,t,lx.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),za(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let m=p.stack||"default",g=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof g=="number"&&Number.isFinite(g)&&(u[m]+=g)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=za(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?_D:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?CD:this.options.fillRatio)*s,d=this.options.maxBarSize==null?PD:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return za(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],m=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),m+=y});let g=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+g)/m,f=g/m,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:m,value:E[1]})}else{let x=(E[1]+g)/m,f=g/m,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:m,value:E[1]})}g+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],m=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),m+=x});let g=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+g)/E.range,b=g/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:m,value:y[1]})}else{let f=(y[1]+g)/E.range,b=g/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:m,value:y[1]})}g+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let m=s[p],g=n==null?m.values[h].min:Math.max(n,m.values[h].min),E=o==null?m.values[h].max:Math.min(m.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(g-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:m.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(g-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:m.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[JP,dn].join(" "):[qP,dn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[Xn]:`${d.category}`,[Et]:`${d.series}`};d.stackId!=null&&(u[Pm]=d.stackId),d.stackTotal!=null&&(u[_m]=`${d.stackTotal}`),d.value!=null&&(u[Om]=`${d.value}`),aB(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;bm(a,l,h,n.color,{size:11},t)}}};c(lx,"type","bar");var Lr=lx;Ya(Lr.type,(i,r)=>new Lr(i,r));function aB(i,r,e,t,n,o,s,a){let l,h=a||Rm;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(ee,Object.assign({d:l},e),t,n)}var C_=class extends jn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:uc.type,options:e.plotOptions||{}}})),L(r,h_),this.$bind(oe,z(Kh),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(oe,z(xm),t=>{let n=t.target,o=parseInt(n.getAttribute(Et),10);this.setFocusedSeries(o)}),this.$bind(ot,z(xm,Kh),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},hx=class hx extends ao{constructor(e,t){var n,o;super(e,t,hx.type);this.chart=e;c(this,"stacked");c(this,"fc");c(this,"Pg");c(this,"yc");c(this,"Tt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.fc=((n=t.marker)==null?void 0:n.enabled)!==!1,this.Pg=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.Tt.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.Tt[h]=this.Tt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.Tt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.Tt[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.Tt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.Tt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.Tt.length;l++){let h=s[l].color,d=`M ${this.Tt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(ee,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[Et]:`${l}`},xm,this.chart.seriesElements[l])}this.yc=k(He,{cx:"0",cy:"0",r:this.Pg/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.fc!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.Tt[s][e];return de(this.yc,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:jc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.fc!==!1&&de(this.yc,{visibility:"hidden"})}};c(hx,"type","area");var uc=hx;Ya(uc.type,(i,r)=>new uc(i,r));var P_=class extends jn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,ZP)}};var __=class extends jn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,KP)}};var cx=class extends Xa{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},O_=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,QP)}$dualValueInit(e){e.series.forEach(t=>{let n=new cx(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,m=n+Math.sqrt(p)*(d-n);return Math.max(n,m)}$getDataPointCssClass(){return e_}};var OD="vjs-gauge-chart",RD="vjs-gauge-track",R_="vjs-gauge-zone",LD="vjs-gauge-tick",wD="vjs-gauge-label",DD="vjs-gauge-needle",ND="vjs-gauge-needle-pivot",L_=class extends so{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"vt");c(this,"vo");c(this,"Re");c(this,"Se");c(this,"Dt");c(this,"xc");this.vt=(n=t.startAngle)!=null?n:-135,this.vo=(o=t.endAngle)!=null?o:135,this.Re=(s=t.innerRadius)!=null?s:.8,this.Se=(a=t.min)!=null?a:0,this.Dt=(l=t.max)!=null?l:100,this.xc=(h=t.value)!=null?h:this.Se,L(e,OD),this.$draw()}getValue(){return this.xc}setValue(e){this.xc=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var ye;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a=j=>(j-90)*Math.PI/180,l=a(this.vt),h=a(this.vo),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),m=Math.sin(l),g=[h];for(let j=-180;j<=270;j+=90){let ge=a(j);j>=this.vt&&j<=this.vo&&g.push(ge)}g.forEach(j=>{d=Math.min(d,Math.cos(j)),u=Math.max(u,Math.cos(j)),p=Math.min(p,Math.sin(j)),m=Math.max(m,Math.sin(j))});let E=.9,y=u-d,x=m-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(m+p)/2,T=f*this.Re,S=b+f*Math.cos(l),R=A+f*Math.sin(l),v=b+f*Math.cos(h),_=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),O=A+T*Math.sin(l),w=this.vo-this.vt<=180?0:1,B=[`M ${S} ${R}`,`A ${f} ${f} 0 ${w} 1 ${v} ${_}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${O}`,"Z"].join(" ");k(ee,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},RD,e);let N=(ye=this.getValue())!=null?ye:this.Se,M=Math.max(this.Se,Math.min(this.Dt,N)),D=this.Dt-this.Se,V=this.vo-this.vt,J=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((j,ge)=>{let Be=j.from,ke=j.to;if(!J){if(M<=Be)return;ke=Math.min(ke,M)}let zt=this.vt+(Be-this.Se)/D*V,or=this.vt+(ke-this.Se)/D*V,tr=a(zt),wr=a(or),ho=b+f*Math.cos(tr),Ha=A+f*Math.sin(tr),ka=b+f*Math.cos(wr),Wa=A+f*Math.sin(wr),Za=b+T*Math.cos(wr),Ja=A+T*Math.sin(wr),Vm=b+T*Math.cos(tr),Gm=A+T*Math.sin(tr),mc=or-zt<=180?0:1,$m=[`M ${ho} ${Ha}`,`A ${f} ${f} 0 ${mc} 1 ${ka} ${Wa}`,`L ${Za} ${Ja}`,`A ${T} ${T} 0 ${mc} 0 ${Vm} ${Gm}`,"Z"].join(" "),gc=j.color;if(j.gradient){let ps=e.querySelector("defs");ps||(ps=k("defs",{},"",e),e.insertBefore(ps,e.firstChild));let ne=`vjs-gauge-gradient-${ge}-${Math.round(Math.random()*1e6)}`,ze=k("linearGradient",{id:ne,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",ps);j.gradient.stops.forEach(Lt=>{k("stop",{offset:`${Lt.offset}%`,"stop-color":Lt.color},"",ze)}),gc=`url(#${ne})`}k(ee,{d:$m,fill:gc,stroke:"none"},`${R_} ${R_}-${ge}`,e)}),this.options.ticks){let j=[];if(this.options.ticks.values)j=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let ge=this.Se;ge<=this.Dt;ge+=this.options.ticks.interval)j.push(ge);j.forEach(ge=>{let Be=this.vt+(ge-this.Se)/D*V,ke=a(Be),zt=f*.95,or=b+f*Math.cos(ke),tr=A+f*Math.sin(ke),wr=b+zt*Math.cos(ke),ho=A+zt*Math.sin(ke);k(ee,{d:`M ${or} ${tr} L ${wr} ${ho}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},LD,e)})}if(this.options.labels){let j=[];if(this.options.labels.values)j=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Be=this.Se;Be<=this.Dt;Be+=this.options.labels.interval)j.push(Be);let ge=f+(this.options.labels.distance||0);j.forEach(Be=>{let ke=this.vt+(Be-this.Se)/D*V,zt=a(ke),or=b+ge*Math.cos(zt),tr=A+ge*Math.sin(zt);k("text",{x:or,y:tr,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},wD,e).textContent=Be.toString()})}if(J){let j=this.vt+(M-this.Se)/D*V,ge=a(j),Be=f*.9,ke=f*.05,zt=ge-Math.PI/2,or=ge+Math.PI/2,tr=b+Be*Math.cos(ge),wr=A+Be*Math.sin(ge),ho=b+ke*Math.cos(zt),Ha=A+ke*Math.sin(zt),ka=b+ke*Math.cos(or),Wa=A+ke*Math.sin(or),Za=`M ${ho} ${Ha} L ${tr} ${wr} L ${ka} ${Wa} Z`;k(ee,{d:Za,fill:"#333",stroke:"#000","stroke-width":1},DD,e);let Ja=ke*1.5;k("circle",{cx:b,cy:A,r:Ja,fill:"#333",stroke:"#666","stroke-width":1},ND,e)}}};var w_=class extends jn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:pc.type,options:t.plotOptions||{}}}));this.options=t;L(e,l_)}},dx=class dx extends ao{constructor(e,t){super(e,t,dx.type);this.chart=e;c(this,"Og");c(this,"_g");this.Og=t.stacked===!0,this._g=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.Og&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var m,g;let p=(g=(m=u.values)==null?void 0:m[h])==null?void 0:g.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}qb(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=SE(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}Qb(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let m,g;return this.$inverted?(g=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,m=u):(m=t.chartWidth*((p-a.minScale)/a.range),g=u),{cx:m,cy:g}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let m=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let g=s[p],E=g.values[u].max,{cx:y,cy:x}=d(m,E);if(E!=null&&this.Rg(s[p],y,x,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),g.isRangeSeries()){let{cx:f,cy:b}=d(m,g.values[u].min);g.values[u].min!=null&&this.Rg(s[p],f,b,g.markerSize||10,g.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:g.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,m=l[u].findIndex(E=>E.hasValue),g=this._g?this.qb(l[u],m):this.Qb(l[u],m);k(ee,{stroke:p,"stroke-width":"1",d:g,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let m=h[u].findIndex(E=>E.hasValue),g=`M ${h[u].slice(m).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(ee,{stroke:p,"stroke-width":"1",d:g,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}Rg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=dc(e.marker,null,{[Xn]:`${l}`,[Et]:`${h}`},[dn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=Im(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[Xn]:`${l}`,[Et]:`${h}`},[dn].join(" "));return d.appendChild(u),u}}};c(dx,"type","line");var pc=dx;Ya(pc.type,(i,r)=>new pc(i,r));var ID="vjs-pie-chart",Mm="vjs-pie-slice",D_="vjs-pie-slice-selected",N_=class extends Ga{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"Co");c(this,"Po");c(this,"bc");c(this,"Qn");c(this,"Re");c(this,"$realisedSeries",[]);c(this,"ln");this.Co=t.selectedCategory,this.bc=t.selectedSliceOffset||10,this.Qn=t.interactive===!0,this.Re=t.innerRadius,this.ln=t.tooltip,this.$init(),this.load(t),this.$bind(st,z(Mm),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.Lg(o),p=this.$dataPoints[d],m=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},m,p.label,{value:p.value})}}),this.$bind(ot,z(Mm),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,z(Mm),n=>{if(this.Qn){let o=n.target,{category:s,series:a}=this.Lg(o);this.eA(s,a,o)}}),L(e,ID)}Lg(e){let t=parseInt(e.getAttribute(Xn),10),n=parseInt(e.parentNode.getAttribute(Et),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.ln&&(this.$tooltip=new Fa(e,this.ln)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},La,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,m)=>{let g=G(q,{"data-name":p.label,"data-category":m});e.appendChild(g);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,R="";if(p.p>=1)if(this.Re!=null){let V=this.Re*h;R=`M ${a.x+h} ${a.y}
|
|
137
137
|
A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
|
|
138
138
|
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y}
|
|
139
139
|
M ${a.x+V} ${a.y}
|
|
140
140
|
A ${V} ${V} 0 1 0 ${a.x-V} ${a.y}
|
|
141
141
|
A ${V} ${V} 0 1 0 ${a.x+V} ${a.y} Z`}else R=`M ${a.x+h} ${a.y}
|
|
142
142
|
A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
|
|
143
|
-
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(R=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this._e!=null){let V=a.x+this._e*h*Math.cos(E),J=a.y+this._e*h*Math.sin(E),ye=a.x+this._e*h*Math.cos(y),j=a.y+this._e*h*Math.sin(y);R=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${ye} ${j} A ${this._e*h} ${this._e*h} 0 ${S} 0 ${V} ${J} Z `}let v={x:this.oh*Math.cos(x),y:this.oh*Math.sin(x)},O=B(te,{fill:u||(d?d[g%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:R,"data-t":`translate(${v.x}, ${v.y})`,[zn]:`${g}`});L(O,Rg),g===this.xo&&this.hg(O),m.appendChild(O);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,_,w,$;if(p.p>=1)if(I&&this._e!=null)_=a.x,w=a.y,$="middle";else{let V=-Math.PI/2;_=a.x+C*Math.cos(V),w=a.y+C*Math.sin(V),$="middle"}else _=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),$=_<a.x?"end":"start";let N=B("text",{"text-anchor":$,"dominant-baseline":"central",x:_,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let M=p.label,D=this.options.showLabels||"label";if(D==="value"?M=`${p.value}`:D==="percentage"?M=`${Math.round(p.p*100)}%`:D==="label-value"?M=`${p.label}: ${p.value}`:D==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=M,m.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&g%2===0?h*.4:h*.5,ye=a.x+J*Math.cos(x),j=a.y+J*Math.sin(x),me=u||(d?d[g%d.length]:this.colorGenerator.generate(p)),Ge=this.options.labelFont||{size:12,weight:"bold"},je="";this.options.dataLabels==="percentage"?je=`${Math.round(p.p*100)}%`:je=`${p.value}`,gg(je,ye,j,me,Ge,m)}})}Nb(){this.bo!=null&&(this.Ib(this.bo),this.bo=null)}hg(e){this.bo=e,this.Mb(this.bo)}Db(e,t,n){this.Nb(),this.xo===e?this.xo=null:(this.xo=e,this.hg(n))}Mb(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,fO)}Ib(e){e.removeAttribute("transform"),F(e,fO)}};function cs(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function fD(i,r,e){return r.reduce((t,n)=>t+cs(n,e),0)}function U$(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function z$(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function Y$(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function X$(i,r,e,t,n,o){j$(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>U$(s),s=>z$(s),o)}function j$(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),g=fD(u,p,h);return u.data.height=g,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:g},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(g=>{a(g.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(g=>{let m=fD(g,o(g),h);g.data.height=m,g.data.width=n,p.push({offset:0,obj:g,size:{width:n,height:m},id:g.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(g.id,!0)}),r(p),d=p}}function xO(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=Y$(T,e),R=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:R})}X$(d,u,s,a,r,o),new As({layers:d},(T,S,R)=>{let v=[];for(let O=0;O<d[S].entries.length;O++)_x(d[S].entries[O].obj,R.obj)&&v.push([d[S].entries[O],O]);return v},null).execute();let g=d[h],E=e*(g.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],R=S.size*y,v=E*y-R,O=S.entries.length-1,P=O>0?Math.max(e,v/(O+2)):e,C=(E*y-(R+P*O))/2;S.entries.forEach(_=>{let w=_.obj.getSourceEdges().length===0;_.size.height*=y,_.obj.data.height*=y,_.obj.data.left=f,_.obj.data.top=C,_.obj.data.layer=T,_.obj.data.isTerminus=w,_.obj.data.isSource=T===0,_.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=_.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)yD(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)yD(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(R=>{let v=R.size.height/y,O=0,P=Array.from(R.obj.getSourceEdges());P.sort((C,_)=>{let w=C.target.data.top+C.target.data.height/2,$=_.target.data.top+_.target.data.height/2;return w<$?-1:w>$?1:0});for(let C=0;C<P.length;C++){let _=cs(P[C],o);P[C].data.lineWidth=_*y;let w=O+_/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},O+=_}O=0;let I=Array.from(R.obj.getTargetEdges());I.sort((C,_)=>{let w=C.source.data.top+C.source.data.height/2,$=_.source.data.top+_.source.data.height/2;return w<$?-1:w>$?1:0});for(let C=0;C<I.length;C++){let _=cs(I[C],o),w=O+_/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},O+=_}});return{layers:d,scale:y}}function yD(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,g=cs(u,r);d+=(p.data.top+p.data.height/2)*g,h+=g}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var bO="sankey-csv",ix="vjs-sankey-edge",Zr="vjs-sankey-unselected",so="vjs-sankey-selected",xD="vjs-sankey",ox="vjs-sankey-node",sx="vjs-sankey-label",SO=class extends io{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"sh");c(this,"ah");c(this,"dg");c(this,"R");c(this,"Ke");c(this,"jn");c(this,"Re");c(this,"So");c(this,"qs");c(this,"To");c(this,"vo",[]);c(this,"kn");c(this,"Co",{});c(this,"Hn",{});c(this,"Oo",{});c(this,"Po",{});c(this,"_o",[]);c(this,"Ao",null);c(this,"lt");c(this,"$tooltip");L(e,xD),Dx("sankey-csv",eA),this.Ao=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.qs=t.labelProperty||"label",this.So=t.valueProperty||"value",this.dg=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.sh=t.nodeWidth||15,this.ah=t.nodePadding||10,this.jn=t.interactive!==!1;let n=t.labels||{};this.lt={font:gi(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.Gb(),this.Pn(t)}get currentModel(){return this.Ao!=null?this.Ke:this.R}Vb(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.R==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=B(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=xO(this.R,this.sh,this.ah,t,n,this.So);if(this.Ao){if(this.Ke.getNodes().length===0){let b=H$(a,this.Ao,this.So,this.qs);this.$b(b)}a=xO(this.Ke,this.sh,this.ah,t,n,this.So).layers}this._o=a;let l=B(q);s.appendChild(l);let h=B(q);s.appendChild(h);let d=B(q);if(s.appendChild(d),this._o.length===0||this._o[0].entries.length===0)return;this.jn&&(this.$tooltip=new AO(e,{format:"{{content}}",valueSuffix:this.dg||""},this.So,this.qs));let u=0,p=0,g=1/0,m=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),g=Math.min(g,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),m=Math.min(m,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=B(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[ee]:b.id},{},ox);this.Hn[b.id]=A,h.appendChild(A),E(A);let T=B(q),S=b.data[this.qs]||b.getFullId(),R=B(Qe,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.lt.padding:b.data.labelAlign==="start"&&b.data.layer===this._o.length-1?b.data.left+b.data.width+this.lt.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.lt.font.size,"font-style":this.lt.font.style,[ee]:b.id},{},sx);if(R.innerHTML=S,this.Oo[b.id]=R,T.appendChild(R),d.appendChild(T),this.lt.backgroundColor!=="transparent"){let v=R.getBBox(),O=B(Z,{rx:"3",x:v.x-this.lt.padding,y:v.y-this.lt.padding,width:v.width+this.lt.padding*2,height:v.height+this.lt.padding*2,fill:this.lt.backgroundColor,[ee]:b.id});this.Po[b.id]=O,T.insertBefore(O,R)}E(R)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,R=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},O={x:R.left,y:R.top+T.y*R.height},P=.25*(O.x-v.x),I=b.data.lineWidth/2,C=v.y-I,_=v.y+I,w=O.y-I,$=O.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${O.x-P} ${w}, ${O.x} ${w}`,`L ${O.x} ${$}`,`C ${O.x-P} ${$}, ${v.x+P} ${_}, ${v.x} ${_}`,"Z"].join(" "),opacity:.3,stroke:"none",[qe]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:V,g:J}=tT(v.x,O.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${V})`}let D=B(te,M,{},ix);this.Co[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-g,n=p+this.dim.chartY,e.setAttribute("viewBox",`${g} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${g}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${m}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-g,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:g,y:0,width:t,height:n},this.fire(Eg)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.Vb(t,n))}Pn(e){if(this.R=an(),this.Ke=an(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Re=e.dataSource;let t=ea(()=>{this.ug()},150);this.Re.bind(Me,t),this.Re.bind(Re,t),this.Re.bind(kt,t),this.Re.bind(_e,t),this.Re.bind(Ie,t),this.Re.bind(jt,t),this.Re.bind(ft,t),this.Re.bind(yt,t),this.Re.bind(sr,t),this.Re.bind(Ht,t),this.Re.bind(Ir,t),this.ug()}}$b(e){this.Ke.clear(),e.nodes.forEach(t=>{this.Ke.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.Ke.getVertex(t.source),o=this.Ke.getVertex(t.target);this.Ke.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}ug(){this.R.clear(),this.Ke.clear(),this.Re.getNodes().forEach(e=>{this.R.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Re.getAllEdges().forEach(e=>{let t=this.R.getVertex(e.source.id),n=this.R.getVertex(e.target.id);this.R.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e){this.Ke.clear(),this.R.clear();function t(){return e.dataType!=null?e.dataType:e.csvData!=null?bO:e.jsonData!=null?Xt:e.url!=null&&e.url.indexOf(".json")!==-1?Xt:bO}this.R.load({type:t(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.R!=null&&this.R.getNodes().length>0}destroy(){super.destroy()}Bb(){this.To!=null&&(this.kn.vertices.forEach(e=>{F(this.Hn[e.id],so),F(this.Oo[e.id],so);let t=this.Po[e.id];t&&F(t,so)}),this.vo.forEach(e=>F(e[1],so)),Object.values(this.Co).forEach(e=>F(e,Zr)),Object.values(this.Hn).forEach(e=>F(e,Zr)),Object.values(this.Oo).forEach(e=>F(e,Zr)),Object.values(this.Po).forEach(e=>F(e,Zr))),this.To=null,this.kn=null,this.vo.length=0}pg(e){return this._o.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}Fb(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}Ub(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.pg(s);this.Fb(s).forEach(d=>{t.has(d[0])||this.pg(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}lh(e){this.Bb(),e!=null&&(this.To=this.currentModel.getNode(e),Object.values(this.Hn).forEach(n=>L(n,Zr)),Object.values(this.Oo).forEach(n=>L(n,Zr)),Object.values(this.Po).forEach(n=>L(n,Zr)),Object.values(this.Co).forEach(n=>L(n,Zr)),this.kn=this.Ub(this.To),this.kn.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.vo=this.kn.edges.map(n=>[n,this.Co[n.id]]),this.kn.vertices.forEach(n=>{$t(this.Hn[n.id],[so],[Zr]),$t(this.Oo[n.id],[so],[Zr]);let o=this.Po[n.id];o&&$t(o,[so],[Zr])}),this.vo.forEach(n=>{$t(n[1],[so],[Zr])}),this.fire("sankey:hover",{vertex:this.To,edges:this.vo}))}Gb(){this.jn&&(this.$eventManager.on(this.container,ot,Y(ox,sx),e=>{let n=e.target.getAttribute(ee);this.lh(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.Hn[n])}),this.$eventManager.on(this.container,it,Y(ox,sx,ix),e=>{this.lh(null)}),this.$eventManager.on(this.container,ot,Y(ix),e=>{let n=e.target.getAttribute(qe);this.lh(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.Co[n])}))}pivot(e){this.Ao=e!=null&&e.length>0?e:null,this.Ke.clear(),this.$draw()}clearPivot(){this.pivot(null)}},AO=class extends Va{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>cs(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>cs(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function H$(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(dn({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(g=>{let m=g.target.id,E=g.data[r]||"Unspecified",y=cs(g,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(m,(b.get(m)||0)+y)})}),h.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:`v_${a}_${m}`,data:{[r]:m,[e]:g}})})}),d.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:m,data:{[r]:p.split("_").pop(),[e]:g}})})})}return{nodes:n,edges:o}}var TO=class extends Ya{constructor(e,t){super(e,t);this.options=t;L(e,FP)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return UP}};
|
|
143
|
+
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(R=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this.Re!=null){let V=a.x+this.Re*h*Math.cos(E),J=a.y+this.Re*h*Math.sin(E),ye=a.x+this.Re*h*Math.cos(y),j=a.y+this.Re*h*Math.sin(y);R=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${ye} ${j} A ${this.Re*h} ${this.Re*h} 0 ${S} 0 ${V} ${J} Z `}let v={x:this.bc*Math.cos(x),y:this.bc*Math.sin(x)},_=G(ee,{fill:u||(d?d[m%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:R,"data-t":`translate(${v.x}, ${v.y})`,[Xn]:`${m}`});L(_,Mm),m===this.Co&&this.wg(_),g.appendChild(_);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,O,w,B;if(p.p>=1)if(I&&this.Re!=null)O=a.x,w=a.y,B="middle";else{let V=-Math.PI/2;O=a.x+C*Math.cos(V),w=a.y+C*Math.sin(V),B="middle"}else O=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=O<a.x?"end":"start";let N=G("text",{"text-anchor":B,"dominant-baseline":"central",x:O,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let M=p.label,D=this.options.showLabels||"label";if(D==="value"?M=`${p.value}`:D==="percentage"?M=`${Math.round(p.p*100)}%`:D==="label-value"?M=`${p.label}: ${p.value}`:D==="label-percentage"&&(M=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=M,g.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let J=p.p<3&&m%2===0?h*.4:h*.5,ye=a.x+J*Math.cos(x),j=a.y+J*Math.sin(x),ge=u||(d?d[m%d.length]:this.colorGenerator.generate(p)),Be=this.options.labelFont||{size:12,weight:"bold"},ke="";this.options.dataLabels==="percentage"?ke=`${Math.round(p.p*100)}%`:ke=`${p.value}`,bm(ke,ye,j,ge,Be,g)}})}tA(){this.Po!=null&&(this.rA(this.Po),this.Po=null)}wg(e){this.Po=e,this.nA(this.Po)}eA(e,t,n){this.tA(),this.Co===e?this.Co=null:(this.Co=e,this.wg(n))}nA(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,D_)}rA(e){e.removeAttribute("transform"),F(e,D_)}};function us(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function MD(i,r,e){return r.reduce((t,n)=>t+us(n,e),0)}function lB(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function hB(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function cB(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function dB(i,r,e,t,n,o){uB(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>lB(s),s=>hB(s),o)}function uB(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),m=MD(u,p,h);return u.data.height=m,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:m},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(m=>{a(m.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(m=>{let g=MD(m,o(m),h);m.data.height=g,m.data.width=n,p.push({offset:0,obj:m,size:{width:n,height:g},id:m.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(m.id,!0)}),r(p),d=p}}function I_(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=cB(T,e),R=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:R})}dB(d,u,s,a,r,o),new Ts({layers:d},(T,S,R)=>{let v=[];for(let _=0;_<d[S].entries.length;_++)Bx(d[S].entries[_].obj,R.obj)&&v.push([d[S].entries[_],_]);return v},null).execute();let m=d[h],E=e*(m.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],R=S.size*y,v=E*y-R,_=S.entries.length-1,P=_>0?Math.max(e,v/(_+2)):e,C=(E*y-(R+P*_))/2;S.entries.forEach(O=>{let w=O.obj.getSourceEdges().length===0;O.size.height*=y,O.obj.data.height*=y,O.obj.data.left=f,O.obj.data.top=C,O.obj.data.layer=T,O.obj.data.isTerminus=w,O.obj.data.isSource=T===0,O.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=O.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)VD(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)VD(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(R=>{let v=R.size.height/y,_=0,P=Array.from(R.obj.getSourceEdges());P.sort((C,O)=>{let w=C.target.data.top+C.target.data.height/2,B=O.target.data.top+O.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let O=us(P[C],o);P[C].data.lineWidth=O*y;let w=_+O/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},_+=O}_=0;let I=Array.from(R.obj.getTargetEdges());I.sort((C,O)=>{let w=C.source.data.top+C.source.data.height/2,B=O.source.data.top+O.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let O=us(I[C],o),w=_+O/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},_+=O}});return{layers:d,scale:y}}function VD(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,m=us(u,r);d+=(p.data.top+p.data.height/2)*m,h+=m}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var M_="sankey-csv",ux="vjs-sankey-edge",Kr="vjs-sankey-unselected",lo="vjs-sankey-selected",GD="vjs-sankey",px="vjs-sankey-node",mx="vjs-sankey-label",G_=class extends so{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"Ac");c(this,"Sc");c(this,"Dg");c(this,"D");c(this,"qe");c(this,"Qn");c(this,"Le");c(this,"_o");c(this,"aa");c(this,"Ro");c(this,"Lo",[]);c(this,"ei");c(this,"wo",{});c(this,"ti",{});c(this,"Do",{});c(this,"No",{});c(this,"Io",[]);c(this,"Oo",null);c(this,"ct");c(this,"$tooltip");L(e,GD),zx("sankey-csv",gA),this.Oo=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.aa=t.labelProperty||"label",this._o=t.valueProperty||"value",this.Dg=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.Ac=t.nodeWidth||15,this.Sc=t.nodePadding||10,this.Qn=t.interactive!==!1;let n=t.labels||{};this.ct={font:xi(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.oA(),this.In(t)}get currentModel(){return this.Oo!=null?this.qe:this.D}iA(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.D==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=G(q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=I_(this.D,this.Ac,this.Sc,t,n,this._o);if(this.Oo){if(this.qe.getNodes().length===0){let b=pB(a,this.Oo,this._o,this.aa);this.sA(b)}a=I_(this.qe,this.Ac,this.Sc,t,n,this._o).layers}this.Io=a;let l=G(q);s.appendChild(l);let h=G(q);s.appendChild(h);let d=G(q);if(s.appendChild(d),this.Io.length===0||this.Io[0].entries.length===0)return;this.Qn&&(this.$tooltip=new V_(e,{format:"{{content}}",valueSuffix:this.Dg||""},this._o,this.aa));let u=0,p=0,m=1/0,g=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),m=Math.min(m,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),g=Math.min(g,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=G(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[te]:b.id},{},px);this.ti[b.id]=A,h.appendChild(A),E(A);let T=G(q),S=b.data[this.aa]||b.getFullId(),R=G(Qe,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.ct.padding:b.data.labelAlign==="start"&&b.data.layer===this.Io.length-1?b.data.left+b.data.width+this.ct.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.ct.font.size,"font-style":this.ct.font.style,[te]:b.id},{},mx);if(R.innerHTML=S,this.Do[b.id]=R,T.appendChild(R),d.appendChild(T),this.ct.backgroundColor!=="transparent"){let v=R.getBBox(),_=G(Z,{rx:"3",x:v.x-this.ct.padding,y:v.y-this.ct.padding,width:v.width+this.ct.padding*2,height:v.height+this.ct.padding*2,fill:this.ct.backgroundColor,[te]:b.id});this.No[b.id]=_,T.insertBefore(_,R)}E(R)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,R=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},_={x:R.left,y:R.top+T.y*R.height},P=.25*(_.x-v.x),I=b.data.lineWidth/2,C=v.y-I,O=v.y+I,w=_.y-I,B=_.y+I,M={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${_.x-P} ${w}, ${_.x} ${w}`,`L ${_.x} ${B}`,`C ${_.x-P} ${B}, ${v.x+P} ${O}, ${v.x} ${O}`,"Z"].join(" "),opacity:.3,stroke:"none",[qe]:b.id};if(b.data.color)M.fill=b.data.color;else if(b.data.gradient){let{id:V,g:J}=ET(v.x,_.x,b.data.gradient);l.appendChild(J),M.fill=`url(#${V})`}let D=G(ee,M,{},ux);this.wo[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-m,n=p+this.dim.chartY,e.setAttribute("viewBox",`${m} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${m}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${g}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-m,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:m,y:0,width:t,height:n},this.fire(Sm)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.iA(t,n))}In(e){if(this.D=hn(),this.qe=hn(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Le=e.dataSource;let t=ra(()=>{this.Ng()},150);this.Le.bind(Ve,t),this.Le.bind(Re,t),this.Le.bind(Zt,t),this.Le.bind(Oe,t),this.Le.bind(Me,t),this.Le.bind(kt,t),this.Le.bind(yt,t),this.Le.bind(xt,t),this.Le.bind(hr,t),this.Le.bind(Wt,t),this.Le.bind(Ir,t),this.Ng()}}sA(e){this.qe.clear(),e.nodes.forEach(t=>{this.qe.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.qe.getVertex(t.source),o=this.qe.getVertex(t.target);this.qe.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}Ng(){this.D.clear(),this.qe.clear(),this.Le.getNodes().forEach(e=>{this.D.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Le.getAllEdges().forEach(e=>{let t=this.D.getVertex(e.source.id),n=this.D.getVertex(e.target.id);this.D.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e){this.qe.clear(),this.D.clear();function t(){return e.dataType!=null?e.dataType:e.csvData!=null?M_:e.jsonData!=null?Ht:e.url!=null&&e.url.indexOf(".json")!==-1?Ht:M_}this.D.load({type:t(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.D!=null&&this.D.getNodes().length>0}destroy(){super.destroy()}aA(){this.Ro!=null&&(this.ei.vertices.forEach(e=>{F(this.ti[e.id],lo),F(this.Do[e.id],lo);let t=this.No[e.id];t&&F(t,lo)}),this.Lo.forEach(e=>F(e[1],lo)),Object.values(this.wo).forEach(e=>F(e,Kr)),Object.values(this.ti).forEach(e=>F(e,Kr)),Object.values(this.Do).forEach(e=>F(e,Kr)),Object.values(this.No).forEach(e=>F(e,Kr))),this.Ro=null,this.ei=null,this.Lo.length=0}Ig(e){return this.Io.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}lA(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}hA(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.Ig(s);this.lA(s).forEach(d=>{t.has(d[0])||this.Ig(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}Tc(e){this.aA(),e!=null&&(this.Ro=this.currentModel.getNode(e),Object.values(this.ti).forEach(n=>L(n,Kr)),Object.values(this.Do).forEach(n=>L(n,Kr)),Object.values(this.No).forEach(n=>L(n,Kr)),Object.values(this.wo).forEach(n=>L(n,Kr)),this.ei=this.hA(this.Ro),this.ei.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.Lo=this.ei.edges.map(n=>[n,this.wo[n.id]]),this.ei.vertices.forEach(n=>{Ft(this.ti[n.id],[lo],[Kr]),Ft(this.Do[n.id],[lo],[Kr]);let o=this.No[n.id];o&&Ft(o,[lo],[Kr])}),this.Lo.forEach(n=>{Ft(n[1],[lo],[Kr])}),this.fire("sankey:hover",{vertex:this.Ro,edges:this.Lo}))}oA(){this.Qn&&(this.$eventManager.on(this.container,st,z(px,mx),e=>{let n=e.target.getAttribute(te);this.Tc(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.ti[n])}),this.$eventManager.on(this.container,ot,z(px,mx,ux),e=>{this.Tc(null)}),this.$eventManager.on(this.container,st,z(ux),e=>{let n=e.target.getAttribute(qe);this.Tc(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.wo[n])}))}pivot(e){this.Oo=e!=null&&e.length>0?e:null,this.qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},V_=class extends $a{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>us(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>us(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function pB(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(pn({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(m=>{let g=m.target.id,E=m.data[r]||"Unspecified",y=us(m,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(g,(b.get(g)||0)+y)})}),h.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:`v_${a}_${g}`,data:{[r]:g,[e]:m}})})}),d.forEach((u,p)=>{u.forEach((m,g)=>{o.push({source:p,target:g,data:{[r]:p.split("_").pop(),[e]:m}})})})}return{nodes:n,edges:o}}var $_=class extends ja{constructor(e,t){super(e,t);this.options=t;L(e,t_)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return r_}};
|